Java swing幾種經常使用的樣式設置

// Metal風格 (默認)
        String lookAndFeel = "javax.swing.plaf.metal.MetalLookAndFeel";
        UIManager.setLookAndFee(lookAndFeel);
// Windows風格
        String lookAndFeel = "com.sun.java.swing.plaf.windows.WindowsLookAndFeel";
        UIManager.setLookAndFee(lookAndFeel);  

// Windows Classic風格
        String lookAndFeel = "com.sun.java.swing.plaf.windows.WindowsClassicLookAndFeel";
        UIManager.setLookAndFee(lookAndFeel);  

// Motif風格
        String lookAndFeel = "com.sun.java.swing.plaf.motif.MotifLookAndFeel";
        UIManager.setLookAndFeel(lookAndFeel);

// Mac風格 (須要在相關的操做系統上方可實現)
        String lookAndFeel = "com.sun.java.swing.plaf.mac.MacLookAndFeel";
        UIManager.setLookAndFeel(lookAndFeel);

// GTK風格 (須要在相關的操做系統上方可實現)
        String lookAndFeel = "com.sun.java.swing.plaf.gtk.GTKLookAndFeel";
        UIManager.setLookAndFeel(lookAndFeel);

// 可跨平臺的默認風格
        String lookAndFeel = UIManager.getCrossPlatformLookAndFeelClassName();
        UIManager.setLookAndFeel(lookAndFeel);

// 當前系統的風格
        String lookAndFeel = UIManager.getSystemLookAndFeelClassName();
        UIManager.setLookAndFeel(lookAndFeel);
相關文章
相關標籤/搜索