zoukankan      html  css  js  c++  java
  • JAVA Swing设置界面统一字体

    //统一界面字体
      private static void InitGlobalFont(Font font) {
        FontUIResource fontRes = new FontUIResource(font);
        for (Enumeration<Object> keys = UIManager.getDefaults().keys();
             keys.hasMoreElements(); ) {
          Object key = keys.nextElement();
          Object value = UIManager.get(key);
          if (value instanceof FontUIResource) {
            UIManager.put(key, fontRes);
          }
        }

    调用: InitGlobalFont(new Font("宋体", Font.PLAIN, 12));

     UIManager.put("Menu.font", new Font("宋体", Font.PLAIN, 12));//设置Menubar的字体 
     UIManager.put("MenuItem.font", new Font("宋体", Font.PLAIN, 12));//设置MenuItem的字体

    //设置界面外观风格

    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());//操作系统的界面风格

    UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");//Java 6 Update 10后的新的Swing 跨平台界面外观

  • 相关阅读:
    bzoj2004(矩阵快速幂,状压DP)
    bzoj1242(弦图判定)
    uva1659(最大费用循环流)
    bzoj1009
    bzoj2893(费用流)
    bzoj4873(最大权闭合子图)
    bzoj2879(动态加边费用流)
    51nod 1239 欧拉筛模板
    poj2774 sa模版
    洛谷3391文艺平衡树
  • 原文地址:https://www.cnblogs.com/hackerd/p/3031504.html
Copyright © 2011-2022 走看看