睫晉姬

          Java中的LookAndFeel

            1、Metal風格 (默認)

            String lookAndFeel = "javax.swing.plaf.metal.MetalLookAndFeel";

            UIManager.setLookAndFeel(lookAndFeel);

            2、Windows風格

            String lookAndFeel = "com.sun.java.swing.plaf.windows.WindowsLookAndFeel";

            UIManager.setLookAndFeel(lookAndFeel);

            3、Windows Classic風格

            String lookAndFeel = "com.sun.java.swing.plaf.windows.WindowsClassicLookAndFeel";

            UIManager.setLookAndFeel(lookAndFeel);

            4、Motif風格

            String lookAndFeel = "com.sun.java.swing.plaf.motif.MotifLookAndFeel";

            UIManager.setLookAndFeel(lookAndFeel);

            5、Mac風格 (需要在相關的操作系統上方可實現)

            String lookAndFeel = "com.sun.java.swing.plaf.mac.MacLookAndFeel";

            UIManager.setLookAndFeel(lookAndFeel);

            6、GTK風格 (需要在相關的操作系統上方可實現)

            String lookAndFeel = "com.sun.java.swing.plaf.gtk.GTKLookAndFeel";

            UIManager.setLookAndFeel(lookAndFeel);

            7、可跨平臺的默認風格

            String lookAndFeel = UIManager.getCrossPlatformLookAndFeelClassName();

            UIManager.setLookAndFeel(lookAndFeel);

            8、當前系統的風格

            String lookAndFeel = UIManager.getSystemLookAndFeelClassName();

            UIManager.setLookAndFeel(lookAndFeel);

            在Java中讓用戶能夠動態地更改應用的外觀,可以給用戶更好地體驗,具體的實現方式是:

            1,先使用UIManager.setLookAndFeel(String s)方法設定對應的外觀

            2,再使用SwingUtilities.updateComponentTreeUI(Component c)方法立刻更新應用的外觀

            這兩個類均在javax.swing包中
          相關文章博客:睫晉姬 睫晉姬 睫晉姬 睫晉姬 睫晉姬 睫晉姬 睫晉姬 睫晉姬

          posted on 2010-07-29 16:00 睫晉姬 閱讀(255) 評論(0)  編輯  收藏


          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          主站蜘蛛池模板: 柯坪县| 疏勒县| 大港区| 太康县| 上杭县| 丹凤县| 长治县| 寿宁县| 宁明县| 安乡县| 石阡县| 镇坪县| 固原市| 清徐县| 深泽县| 伊宁市| 隆昌县| 永川市| 滨州市| 宁津县| 介休市| 延长县| 灵璧县| 玉龙| 耒阳市| 白城市| 比如县| 嘉荫县| 曲松县| 庆元县| 拉孜县| 五原县| 禹城市| 水富县| 克拉玛依市| 会泽县| 盘锦市| 宁国市| 临泉县| 富阳市| 海城市|