jDialog呢?
2 个解决方案
#1
import javax.swing.plaf.metal.*;
import javax.swing.*;
import java.awt.event.*;
class NoIconTheme extends DefaultMetalTheme {
public String getName() { return "WithoutIcon"; }
public void addCustomEntriesToTable(UIDefaults table) {
super.addCustomEntriesToTable(table);
final int size = 0;
table.put("InternalFrame.closeIcon", MetalIconFactory.getInternalFrameCloseIcon(size));
table.put("InternalFrame.maximizeIcon", MetalIconFactory.getInternalFrameMaximizeIcon(size));
table.put("InternalFrame.minimizeIcon", MetalIconFactory.getInternalFrameAltMaximizeIcon(size));
}
}
public class test extends JFrame {
public static void main( String[] args ) {
JFrame.setDefaultLookAndFeelDecorated(true);
try {
javax.swing.plaf.metal.MetalLookAndFeel.setCurrentTheme( new NoIconTheme());
UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
}
catch ( Exception e ) {}
test frame = new test();
frame.setTitle("Alt+F4 to close");
frame.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e){
System.exit(0);
}
});
frame.setSize(300,400);
frame.setVisible(true);
}
}
import javax.swing.*;
import java.awt.event.*;
class NoIconTheme extends DefaultMetalTheme {
public String getName() { return "WithoutIcon"; }
public void addCustomEntriesToTable(UIDefaults table) {
super.addCustomEntriesToTable(table);
final int size = 0;
table.put("InternalFrame.closeIcon", MetalIconFactory.getInternalFrameCloseIcon(size));
table.put("InternalFrame.maximizeIcon", MetalIconFactory.getInternalFrameMaximizeIcon(size));
table.put("InternalFrame.minimizeIcon", MetalIconFactory.getInternalFrameAltMaximizeIcon(size));
}
}
public class test extends JFrame {
public static void main( String[] args ) {
JFrame.setDefaultLookAndFeelDecorated(true);
try {
javax.swing.plaf.metal.MetalLookAndFeel.setCurrentTheme( new NoIconTheme());
UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
}
catch ( Exception e ) {}
test frame = new test();
frame.setTitle("Alt+F4 to close");
frame.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e){
System.exit(0);
}
});
frame.setSize(300,400);
frame.setVisible(true);
}
}
#2
frame.setResiable(false);
frame.setBorder(null);
frame.setUndecorated(true);
这样也可以
frame.setBorder(null);
frame.setUndecorated(true);
这样也可以
#1
import javax.swing.plaf.metal.*;
import javax.swing.*;
import java.awt.event.*;
class NoIconTheme extends DefaultMetalTheme {
public String getName() { return "WithoutIcon"; }
public void addCustomEntriesToTable(UIDefaults table) {
super.addCustomEntriesToTable(table);
final int size = 0;
table.put("InternalFrame.closeIcon", MetalIconFactory.getInternalFrameCloseIcon(size));
table.put("InternalFrame.maximizeIcon", MetalIconFactory.getInternalFrameMaximizeIcon(size));
table.put("InternalFrame.minimizeIcon", MetalIconFactory.getInternalFrameAltMaximizeIcon(size));
}
}
public class test extends JFrame {
public static void main( String[] args ) {
JFrame.setDefaultLookAndFeelDecorated(true);
try {
javax.swing.plaf.metal.MetalLookAndFeel.setCurrentTheme( new NoIconTheme());
UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
}
catch ( Exception e ) {}
test frame = new test();
frame.setTitle("Alt+F4 to close");
frame.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e){
System.exit(0);
}
});
frame.setSize(300,400);
frame.setVisible(true);
}
}
import javax.swing.*;
import java.awt.event.*;
class NoIconTheme extends DefaultMetalTheme {
public String getName() { return "WithoutIcon"; }
public void addCustomEntriesToTable(UIDefaults table) {
super.addCustomEntriesToTable(table);
final int size = 0;
table.put("InternalFrame.closeIcon", MetalIconFactory.getInternalFrameCloseIcon(size));
table.put("InternalFrame.maximizeIcon", MetalIconFactory.getInternalFrameMaximizeIcon(size));
table.put("InternalFrame.minimizeIcon", MetalIconFactory.getInternalFrameAltMaximizeIcon(size));
}
}
public class test extends JFrame {
public static void main( String[] args ) {
JFrame.setDefaultLookAndFeelDecorated(true);
try {
javax.swing.plaf.metal.MetalLookAndFeel.setCurrentTheme( new NoIconTheme());
UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
}
catch ( Exception e ) {}
test frame = new test();
frame.setTitle("Alt+F4 to close");
frame.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e){
System.exit(0);
}
});
frame.setSize(300,400);
frame.setVisible(true);
}
}
#2
frame.setResiable(false);
frame.setBorder(null);
frame.setUndecorated(true);
这样也可以
frame.setBorder(null);
frame.setUndecorated(true);
这样也可以