Swing美化 JAVA UIManager键列表

Shaka 18天前 ⋅ 27 阅读

 

//改变皮肤
UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
//UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsClassicLookAndFeel");
//UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel");
//UIManager.setLookAndFeel("com.sun.java.swing.plaf.mac.MacLookAndFeel");
//UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel");
//UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
//UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
//UIManager.setLookAndFeel(javax.swing.plaf.nimbus.NimbusLookAndFeel.class.getName());
SwingUtilities.updateComponentTreeUI(window);
//改变字体
public static void setUIFont()
{
UIManager.put("TabbedPane.font",new Font("黑体",Font.PLAIN,16));
String names[]={ "Label", "CheckBox", "PopupMenu","MenuItem", "CheckBoxMenuItem",
"JRadioButtonMenuItem","ComboBox", "Button", "Tree", "ScrollPane",
"EditorPane", "TitledBorder", "Menu", "TextArea",
"OptionPane", "MenuBar", "ToolBar", "ToggleButton", "ToolTip",
"ProgressBar", "TableHeader", "Panel", "List", "ColorChooser",
"PasswordField","TextField", "Table", "Label", "Viewport",
"RadioButtonMenuItem","RadioButton", "DesktopPane", "InternalFrame"
};
for (String item : names) {
UIManager.put(item+ ".font",new Font("黑体",Font.PLAIN,14));
}
}
//获取UIKEY
public static void printUIManagerKeys()
{
UIDefaults defaults = UIManager.getDefaults();
Enumeration<Object> keysEnumeration = defaults.keys();
while (keysEnumeration!=null)
{
System.out.println(keysEnumeration.nextElement());
}
}

注意:本文归作者所有,未经作者允许,不得转载

全部评论: 0

    我有话说: