zoukankan      html  css  js  c++  java
  • 图形界面系列教材 (十四)- Swing 皮肤 Look And Feel

    Java提供了非常便捷的方式切换界面风格

    步骤1:设置皮肤

    步骤 1 : 设置皮肤

    只需要提供一句代码

    javax.swing.UIManager.setLookAndFeel("com.birosoft.liquid.LiquidLookAndFeel");


    就可以把所有的组件切换成不同的风格。

    注: 这句话需要加在最前面,如果已经创建了界面,再加这个有时候不能正常起作用。

    在右侧的附件里提供了各种皮肤,以及皮肤对应的jar包的下载

    设置皮肤

    package gui;

      

    import javax.swing.JButton;

    import javax.swing.JFrame;

      

    public class TestGUI {

        public static void main(String[] args) {

            //设置皮肤 

            setLookAndFeel();

            JFrame f = new JFrame("LoL");

            f.setSize(400300);

            f.setLocation(200200);

            f.setLayout(null);

            JButton b = new JButton("一键秒对方基地挂");

            b.setBounds(505028030);

      

            f.add(b);

            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

      

            f.setVisible(true);

        }

      

        private static void setLookAndFeel() {

            try {

              javax.swing.UIManager.setLookAndFeel("com.birosoft.liquid.LiquidLookAndFeel");

    //          javax.swing.UIManager.setLookAndFeel("com.jtattoo.plaf.smart.SmartLookAndFeel");

    //          javax.swing.UIManager.setLookAndFeel("com.jtattoo.plaf.mcwin.McWinLookAndFeel");

    //          javax.swing.UIManager.setLookAndFeel("com.jtattoo.plaf.luna.LunaLookAndFeel");

    //          javax.swing.UIManager.setLookAndFeel("com.jtattoo.plaf.aluminium.AluminiumLookAndFeel");

    //          javax.swing.UIManager.setLookAndFeel("com.jtattoo.plaf.bernstein.BernsteinLookAndFeel");

    //          javax.swing.UIManager.setLookAndFeel("com.jtattoo.plaf.hifi.HiFiLookAndFeel");

    //          javax.swing.UIManager.setLookAndFeel("com.jtattoo.plaf.mint.MintLookAndFeel");

    //          javax.swing.UIManager.setLookAndFeel("com.jtattoo.plaf.aero.AeroLookAndFeel");

    //          javax.swing.UIManager.setLookAndFeel("com.jtattoo.plaf.fast.FastLookAndFeel");

    //          javax.swing.UIManager.setLookAndFeel("com.jtattoo.plaf.acryl.AcrylLookAndFeel");

    //          javax.swing.UIManager.setLookAndFeel("com.jtattoo.plaf.noire.NoireLookAndFeel"); 

            catch (Exception e) {

                e.printStackTrace();

                // handle exception

            }

      

        }

    }


    更多内容,点击了解: https://how2j.cn/k/gui/gui-lookandfeel/411.html

  • 相关阅读:
    TCP/IP详解学习笔记(3)IP协议ARP协议和RARP协议
    TCP/IP详解学习笔记(2)-数据链路层
    TCP/IP详解学习笔记(1)-基本概念
    HTTP协议学习
    Windows下Git多账号配置,同一电脑多个ssh-key的管理
    Linux定时任务Crontab命令详解
    样式化复选框(Styling Checkbox)
    emmm 深入浅出教你看懂现代金融游戏
    今日工作收获(2018/2/27)
    html upload_file 对象(2018/02/26)工作收获
  • 原文地址:https://www.cnblogs.com/Lanht/p/12615443.html
Copyright © 2011-2022 走看看