如何将不同的主题应用于桌面摇摆软件?

时间:2017-05-19 17:52:22

标签: java swing themes

我想对jframe,面板,组件等组件应用不同的主题。我想创建一个主题来处理来自文件(XML,JSON或相同)的数据。

1 个答案:

答案 0 :(得分:4)

首先,你需要考虑不同的主题,如webapp,使用swing组件的桌面GUI,以及midi app。它将与更多标准相关。

L& F有一些链接:

  String srt1 = "javax.swing.plaf.metal.MetalLookAndFeel";
  String srt2 = "javax.swing.plaf.nimbus.NimbusLookAndFeel";
  String srt3 = "com.sun.java.swing.plaf.windows.WindowsLookAndFeel";
  String srt4 = "com.sun.java.swing.plaf.windows.WindowsClassicLookAndFeel";
  String srt5 = "com.sun.java.swing.plaf.motif.MotifLookAndFeel";
  String srt6 = "com.sun.java.swing.plaf.gtk.GTKLookAndFeel";
...

使用示例(例如在构造函数中):

        try {
            UIManager.setLookAndFeel(str1);
            SwingUtilities.updateComponentTreeUI(this);
        } catch (Exception e) {
            e.printStackTrace();
        }
        JFrame.setDefaultLookAndFeelDecorated(true);