其实Swing 是自身带了五种皮肤可以通过下面的代码进行设置
import javax.swing.*;
import java.awt.*;
public class Main {
public static void main(String[] args) {
//使用SWING自己代的皮肤中的WINDOWS中的皮肤
try{
javax.swing.UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
}catch(Exception e){
e.printStackTrace();
}
JFrame jf = new JFrame("This is Max JFrame");
jf.pack();
jf.setDefaultCloseOperation(jf.EXIT_ON_CLOSE);
jf.setExtendedState(jf.MAXIMIZED_BOTH);
Panel p = new Panel();
p.setBackground(Color.YELLOW);
jf.add(p);
p.add(new JButton("Press Me!"));
jf.setVisible(true);
}
}
import java.awt.*;
public class Main {
public static void main(String[] args) {
//使用SWING自己代的皮肤中的WINDOWS中的皮肤
try{
javax.swing.UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
}catch(Exception e){
e.printStackTrace();
}
JFrame jf = new JFrame("This is Max JFrame");
jf.pack();
jf.setDefaultCloseOperation(jf.EXIT_ON_CLOSE);
jf.setExtendedState(jf.MAXIMIZED_BOTH);
Panel p = new Panel();
p.setBackground(Color.YELLOW);
jf.add(p);
p.add(new JButton("Press Me!"));
jf.setVisible(true);
}
}