Topic: 请问如何设置Swing的缺省字体? |
Print this page |
1.请问如何设置Swing的缺省字体? | Copy to clipboard |
Posted by: lifangning Posted on: 2004-03-26 12:58 在W2000下,默认字体太难看。 |
2.Re:请问如何设置Swing的缺省字体? [Re: lifangning] | Copy to clipboard |
Posted by: yuwang1974 Posted on: 2004-03-30 17:49 同问。 |
3.Re:请问如何设置Swing的缺省字体? [Re: lifangning] | Copy to clipboard |
Posted by: yuwang1974 Posted on: 2004-03-30 17:50 |
4.Re:请问如何设置Swing的缺省字体? [Re: lifangning] | Copy to clipboard |
Posted by: shuyo Posted on: 2004-03-30 21:37 int uiFontSize = 12; UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); if (uiFontSize > 0) { java.awt.Font nbDialogPlain = new javax.swing.plaf.FontUIResource( "宋体", java.awt.Font.TRUETYPE_FONT, uiFontSize); // NOI18N java.awt.Font nbDialogBold = new javax.swing.plaf.FontUIResource( "宋体", java.awt.Font.BOLD, uiFontSize); // NOI18N java.awt.Font nbSerifPlain = new javax.swing.plaf.FontUIResource( "宋体", java.awt.Font.TRUETYPE_FONT, uiFontSize); // NOI18N java.awt.Font nbSansSerifPlain = new javax.swing.plaf.FontUIResource( "宋体", java.awt.Font.TRUETYPE_FONT, uiFontSize); // NOI18N java.awt.Font nbMonospacedPlain = new javax.swing.plaf.FontUIResource( "宋体", java.awt.Font.TRUETYPE_FONT, uiFontSize); // NOI18N UIManager.getDefaults().put("Button.font", nbDialogPlain); // NOI18N UIManager.getDefaults().put("ToggleButton.font", nbDialogPlain); // NOI18N UIManager.getDefaults().put("RadioButton.font", nbDialogPlain); // NOI18N UIManager.getDefaults().put("CheckBox.font", nbDialogPlain); // NOI18N UIManager.getDefaults().put("ColorChooser.font", nbDialogPlain); // NOI18N UIManager.getDefaults().put("ComboBox.font", nbDialogPlain); // NOI18N UIManager.getDefaults().put("Label.font", nbDialogPlain); // NOI18N UIManager.getDefaults().put("List.font", nbDialogPlain); // NOI18N UIManager.getDefaults().put("MenuBar.font", nbDialogPlain); // NOI18N UIManager.getDefaults().put("MenuItem.font", nbDialogPlain); // NOI18N UIManager.getDefaults().put("MenuItem.acceleratorFont", nbDialogPlain); // NOI18N UIManager.getDefaults().put("RadioButtonMenuItem.font", nbDialogPlain); // NOI18N UIManager.getDefaults().put("CheckBoxMenuItem.font", nbDialogPlain); // NOI18N UIManager.getDefaults().put("Menu.font", nbDialogPlain); // NOI18N UIManager.getDefaults().put("PopupMenu.font", nbDialogPlain); // NOI18N UIManager.getDefaults().put("OptionPane.font", nbDialogPlain); // NOI18N UIManager.getDefaults().put("Panel.font", nbDialogPlain); // NOI18N UIManager.getDefaults().put("ProgressBar.font", nbDialogPlain); // NOI18N UIManager.getDefaults().put("ScrollPane.font", nbDialogPlain); // NOI18N UIManager.getDefaults().put("Viewport.font", nbDialogPlain); // NOI18N UIManager.getDefaults().put("TabbedPane.font", nbDialogPlain); // NOI18N UIManager.getDefaults().put("Table.font", nbDialogPlain); // NOI18N UIManager.getDefaults().put("TableHeader.font", nbDialogPlain); // NOI18N UIManager.getDefaults().put("TextField.font", nbSansSerifPlain); // NOI18N UIManager.getDefaults().put("PasswordField.font", nbMonospacedPlain); // NOI18N UIManager.getDefaults().put("TextArea.font", nbMonospacedPlain); // NOI18N UIManager.getDefaults().put("TextPane.font", nbSerifPlain); // NOI18N UIManager.getDefaults().put("EditorPane.font", nbSerifPlain); // NOI18N UIManager.getDefaults().put("TitledBorder.font", nbDialogPlain); // NOI18N UIManager.getDefaults().put("ToolBar.font", nbDialogPlain); // NOI18N UIManager.getDefaults().put("ToolTip.font", nbSansSerifPlain); // NOI18N UIManager.getDefaults().put("Tree.font", nbDialogPlain); // NOI18N UIManager.getDefaults().put("InternalFrame.titleFont", nbDialogBold); // NOI18N UIManager.getDefaults().put("windowTitleFont", nbDialogBold); // NOI18N UIManager.getDefaults().put("controlFont", nbDialogPlain); // NOI18N |
5.Re:请问如何设置Swing的缺省字体? [Re: lifangning] | Copy to clipboard |
Posted by: 九佰 Posted on: 2004-04-21 12:52 try { UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); Font font = new Font("Dialog", Font.PLAIN, 12); UIManager.put("MenuBar.font", font); UIManager.put("MenuItem.font", font); UIManager.put("Menu.font", font); UIManager.put("PopupMenu.font", font); UIManager.put("ToolBar.font", font); UIManager.put("ToolTip.font", font); UIManager.put("TabbedPane.font", font); UIManager.put("Label.font", font); UIManager.put("List.font", font); UIManager.put("ComboBox.font", font); UIManager.put("Button.font", font); UIManager.put("Table.font", font); UIManager.put("TableHeader.font", font); UIManager.put("Tree.font", font); UIManager.put("TextField.font", font); UIManager.put("TextArea.font", font); UIManager.put("TitledBorder.font", font); UIManager.put("OptionPane.font", font); UIManager.put("RadioButton.font", font); UIManager.put("CheckBox.font", font); UIManager.put("ToggleButton.font", font); UIManager.put("Dialog.font", font); UIManager.put("Panel.font", font); } catch (Exception e) { e.printStackTrace(); } |
Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1 客服电话 18559299278 客服信箱 714923@qq.com 客服QQ 714923 |