public class TestSwing extends JFrame {
private static final long serialVersionUID = 1L;
public TestSwing() {
this.setTitle("SubstanceLookAndFeel");
this.setVisible(true);
this.setSize(600, 400);
this.setLocationRelativeTo(this.getOwner());
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setIconImage(Toolkit.getDefaultToolkit().createImage(TestSwing.class.getResource("image388.png")));
// });
}
public static void main(String[] args) {
JFrame.setDefaultLookAndFeelDecorated(true);
// try {
// UIManager.setLookAndFeel(new SubstanceMistAquaLookAndFeel());
// }
// catch (Exception e) {
// System.out.println("Substance Raven Graphite failed to initialize");
// }
SubstanceLookAndFeel.setSkin(new BusinessBlackSteelSkin());
SwingUtilities.invokeLater(new Runnable() {
public void run() {
new TestSwing();
// ts.setVisible(true);
}
});
}
}
private static final long serialVersionUID = 1L;
public TestSwing() {
this.setTitle("SubstanceLookAndFeel");
this.setVisible(true);
this.setSize(600, 400);
this.setLocationRelativeTo(this.getOwner());
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setIconImage(Toolkit.getDefaultToolkit().createImage(TestSwing.class.getResource("image388.png")));
// });
}
public static void main(String[] args) {
JFrame.setDefaultLookAndFeelDecorated(true);
// try {
// UIManager.setLookAndFeel(new SubstanceMistAquaLookAndFeel());
// }
// catch (Exception e) {
// System.out.println("Substance Raven Graphite failed to initialize");
// }
SubstanceLookAndFeel.setSkin(new BusinessBlackSteelSkin());
SwingUtilities.invokeLater(new Runnable() {
public void run() {
new TestSwing();
// ts.setVisible(true);
}
});
}
}
本文介绍了一个使用Java Swing创建自定义用户界面的例子。通过设置Substance LookAndFeel和Business Black Steel皮肤,实现了界面风格的统一与美化。此外,还展示了如何初始化JFrame并设置其属性。
806

被折叠的 条评论
为什么被折叠?



