So we will use:
UIManager.getLookAndFeelDefaults(). put ( "OptionPane.messageFont", ( "Arial", Font.BOLD, 14)); UIManager.getLookAndFeelDefaults(). Put ( "OptionPane.buttonFont", ( "Arial", Font.PLAIN, 12)); >
UIManager.put("OptionPane.messageFont", new Font("Arial", Font.BOLD, 14));
UIManager.put("OptionPane.buttonFont", new Font("Arial", Font.PLAIN, 12));
JOptionPane. main.
, , DOC UIManager.
UIManager UIDefaults. :
. Swing ; .
. ( setLookAndFeel()). getLookAndFeelDefaults().
. Swing. get , . , UIManager.getString( "Table.foreground" ) . "Table.foreground", , , . , getDefaults UIDefaults . , UIManager.getDefaults(). GetString ( "Table.foreground" ) UIManager.getString( "Table.foreground" ). . defaults UIDefaults , .
, . UIManager.put(Object key, Object value) - , .
public static Object put ( , )
. getDefaults(). Put (, ). , .
:
key - ,
value - ; UIDefaults , null
: , UIDefaults.put(java.lang.Object, java.lang.Object)
:
NullPointerException - null
, : , JOptionPane.
JOptionPane :
http://www.java2s.com/Tutorial/Java/0240__Swing/CustomizingaJOptionPaneLookandFeel.htm
Property String Object Type
OptionPane.actionMap ActionMap
OptionPane.background Color
OptionPane.border Border
OptionPane.buttonAreaBorder Border
OptionPane.buttonClickThreshhold Integer
OptionPane.buttonFont Font
OptionPane.buttonOrientation Integer
OptionPane.buttonPadding Integer
OptionPane.cancelButtonMnemonic String
OptionPane.cancelButtonText String
OptionPane.cancelIcon Icon
OptionPane.errorDialog.border.background Color
OptionPane.errorDialog.titlePane.background Color
OptionPane.errorDialog.titlePane.foreground Color
OptionPane.errorDialog.titlePane.shadow Color
OptionPane.errorIcon Icon
OptionPane.errorSound String
OptionPane.font Font
OptionPane.foreground Color
OptionPane.informationIcon Icon
OptionPane.informationSound String
OptionPane.inputDialogTitle String
OptionPane.isYesLast Boolean
OptionPane.messageAnchor Integer
OptionPane.messageAreaBorder Border
OptionPane.messageFont Font
OptionPane.messageForeground Color
OptionPane.messageDialogTitle String
OptionPane.minimumSize Dimension
OptionPane.noButtonMnemonic String
OptionPane.noButtonText String
OptionPane.noIcon Icon
OptionPane.okButtonMnemonic String
OptionPane.okButtonText String
OptionPane.okIcon Icon
OptionPane.questionDialog.border.background Color
OptionPane.questionDialog.titlePane.background Color
OptionPane.questionDialog.titlePane.foreground Color
OptionPane.questionDialog.titlePane.shadow Color
OptionPane.questionIcon Icon
OptionPane.questionSound String
OptionPane.sameSizeButtons Boolean
OptionPane.separatorPadding Integer
OptionPane.setButtonMargin Boolean
OptionPane.titleText String
OptionPane.warningDialog.border.background Color
OptionPane.warningDialog.titlePane.background Color
OptionPane.warningDialog.titlePane.foreground Color
OptionPane.warningDialog.titlePane.shadow Color
OptionPane.warningIcon Icon
OptionPane.warningSound String
OptionPane.windowBindings Object[ ]
OptionPane.yesButtonMnemonic String
OptionPane.yesButtonText String
OptionPane.yesIcon Icon
OptionPaneUI String