javax.swing.UIManager:
UIManager manages the current look and feel, the set of available look and feels, PropertyChangeListeners that are notified when the look and feel changes, look and feel defaults, and convenience methods for obtaining various default values.Java event handler
Specifying the look and feel:
The look and feel can be specified in two distinct ways: by specifying the fully qualified name of the class for the look and feel, or by creating an instance of LookAndFeel and passing it to setLookAndFeel. The following example illustrates setting the look and feel to the system look and feel.UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());The following example illustrates setting the look and feel based on class name:
UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
UIManager.getDefaults():
getDefaults method is to get the default list of keys that available in UIManager.Syntax:
public static UIDefaults getDefaults()
Returns the defaults. The returned defaults resolve using the logic specified in the class documentation.
Returns:
a UIDefaults object containing the default valuesKeys for UIManager are Look and Feels sensitive, means (for example) value Keys for Metal Look and Feel could be diferrent when you comparing value from System Look and Feel.
Example program to get UIManager keys list:
Here is the program to get the list of all the keys available in the swing UIManager. This will help to find out the look and feel parameters.
package examples.java.w3schools.swings; import java.util.ArrayList; import java.util.Collections; import java.util.Enumeration; import javax.swing.UIDefaults; import javax.swing.UIManager; public class UIManagerKeysListExample { public static void main(String[] args) { printUIManagerKeys(); } public static void printUIManagerKeys() { UIDefaults defaults = UIManager.getDefaults(); Enumeration keysEnumeration = defaults.keys(); ArrayList keysList = Collections.list(keysEnumeration); for (Object key : keysList) { if (defaults.getString(key) != null) { System.out.println(key + " - " + defaults.getString(key)); } } System.out.println(keysList.size()); } }
Output:
The above program produces the below output for the UIManager keys list. The total keys are 641. All listed below.TextField.caretForeground
FileView.directoryIcon
Table.focusCellBackground
ListUI
TextField.highlight
TextPane.selectionBackground
RadioButtonMenuItem.background
FileView.fileIcon
TextPane.margin
CheckBox.disabledText
SplitPane.border
Menu.selectionBackground
ToggleButton.textIconGap
EditorPane.inactiveForeground
TabbedPaneUI
TabbedPane.selectedLabelShift
Spinner.editorBorderPainted
InternalFrameUI
ComboBox.selectionForeground
ScrollBar.darkShadow
Slider.tickColor
InternalFrame.restoreUpSound
CheckBoxMenuItem.acceleratorSelectionForeground
OptionPane.informationSound
ToolTip.background
RootPane.colorChooserDialogBorder
Tree.selectionForeground
TextField.inactiveForeground
FormattedTextField.background
ToolBar.nonrolloverBorder
ButtonUI
ToolTip.backgroundInactive
OptionPaneUI
Table.font
TextField.light
PasswordField.border
EditorPane.margin
CheckBox.focusInputMap
OptionPane.errorDialog.border.background
Menu.margin
MenuItem.selectionBackground
CheckBoxMenuItem.arrowIcon
TextArea.foreground
Table.sortIconColor
TextPane.caretBlinkRate
TabbedPane.darkShadow
OptionPane.warningDialog.border.background
DesktopIcon.font
FileChooser.useSystemExtensionHiding
Slider.shadow
Menu.selectionForeground
Button.textShiftOffset
FormattedTextField.selectionForeground
Slider.altTrackColor
Tree.expandedIcon
ComboBox.buttonHighlight
Menu.background
ToolTip.border
TabbedPane.contentAreaColor
Spinner.arrowButtonInsets
RadioButton.darkShadow
Slider.focus
EditorPane.focusInputMap
Table.focusCellHighlightBorder
TabbedPane.highlight
Tree.editorBorder
RadioButton.focus
infoText
ToggleButton.light
Tree.background
TextField.background
FileChooser.ancestorInputMap
ScrollBar.trackHighlight
TextField.border
menu
RadioButtonMenuItem.disabledForeground
CheckBox.icon
List.noFocusBorder
MenuItem.font
ProgressBar.border
RadioButton.textIconGap
CheckBox.textIconGap
List.background
OptionPane.warningIcon
TreeUI
OptionPane.errorSound
ToolTip.hideAccelerator
OptionPane.windowBindings
Tree.changeSelectionWithFocus
InternalFrame.restoreDownSound
RadioButton.margin
controlShadow
Panel.foreground
OptionPane.minimumSize
ScrollBar.thumbHighlight
ComboBox.buttonDarkShadow
Tree.textForeground
MenuBar.shadow
ToolTipUI
ColorChooser.foreground
InternalFrame.minimizeSound
ToggleButton.select
List.dropLineColor
textInactiveText
ScrollPaneUI
OptionPane.border
InternalFrame.paletteTitleHeight
PasswordField.caretBlinkRate
Slider.trackWidth
EditorPane.background
RootPane.warningDialogBorder
ScrollBar.gradient
TabbedPane.tabInsets
Tree.rightChildIndent
ProgressBar.repaintInterval
InternalFrame.paletteCloseIcon
List.dropCellBackground
RadioButtonUI
InternalFrame.border
ScrollPane.ancestorInputMap
List.selectionForeground
ScrollBar.ancestorInputMap
TextField.selectionForeground
CheckBoxMenuItem.acceleratorForeground
MenuItem.acceleratorFont
RadioButton.font
FormattedTextField.focusInputMap
Button.highlight
info
ProgressBar.background
RadioButtonMenuItem.selectionForeground
ProgressBar.foreground
ComboBox.disabledForeground
Slider.onlyLeftMouseButtonDrag
Panel.font
OptionPane.errorIcon
Table.gridColor
MenuItem.checkIcon
ScrollPane.border
InternalFrame.icon
Slider.focusGradient
MenuBar.windowBindings
OptionPane.font
activeCaptionBorder
desktop
Button.textIconGap
Table.ancestorInputMap
RadioButtonMenuItem.font
RadioButton.rollover
InternalFrame.maximizeIcon
TableHeader.font
TextPane.font
FileChooser.detailsViewIcon
Separator.background
Slider.minimumVerticalSize
RadioButton.foreground
PasswordField.font
Button.margin
ToolBar.light
control
SplitPane.dividerFocusColor
CheckBox.foreground
InternalFrame.activeTitleForeground
ScrollBar.thumb
TableHeader.background
Menu.acceleratorSelectionForeground
Slider.horizontalThumbIcon
TextArea.focusInputMap
OptionPane.warningDialog.titlePane.background
ComboBox.buttonShadow
PopupMenu.font
RootPane.frameBorder
OptionPane.questionDialog.border.background
Button.disabledText
TabbedPane.selected
InternalFrame.titleFont
ToolBar.isRollover
RadioButtonMenuItem.acceleratorForeground
Tree.selectionBorderColor
ToolBar.dockingForeground
ToggleButton.shadow
FileChooser.listViewIcon
ScrollPane.foreground
ToolBar.font
InternalFrame.activeTitleGradient
ComboBox.isEnterSelectablePopup
Checkbox.select
CheckBoxMenuItem.commandSound
Menu.acceleratorForeground
Tree.rowHeight
OptionPane.background
InternalFrame.inactiveTitleBackground
Separator.foreground
inactiveCaption
DesktopIcon.width
controlDkShadow
InternalFrame.borderShadow
Button.border
Tree.closedIcon
text
AuditoryCues.noAuditoryCues
MenuItem.acceleratorDelimiter
ToggleButton.darkShadow
RadioButtonMenuItem.border
ToolBarSeparatorUI
InternalFrame.borderColor
MenuItem.disabledForeground
inactiveCaptionText
TextArea.caretBlinkRate
Label.background
ComboBox.background
Table.foreground
ProgressBar.cellSpacing
ToggleButtonUI
TextFieldUI
ToggleButton.foreground
Viewport.foreground
MenuBar.gradient
ScrollBar.foreground
ToggleButton.disabledText
Spinner.font
ToolBar.background
TabbedPane.contentOpaque
ProgressBar.cycleTime
FormattedTextField.caretForeground
RadioButton.gradient
ToolBar.floatingBackground
MenuItem.foreground
TextField.focusInputMap
Menu.preserveTopLevelSelection
RadioButtonMenuItem.commandSound
RadioButtonMenuItem.gradient
MenuBar.border
TextPane.focusInputMap
RadioButtonMenuItem.selectionBackground
Desktop.minOnScreenInsets
RadioButtonMenuItem.arrowIcon
TabbedPane.tabAreaBackground
Menu.acceleratorFont
OptionPane.errorDialog.titlePane.shadow
ToolTip.font
OptionPane.informationIcon
InternalFrame.borderHighlight
InternalFrame.maximizeSound
CheckBoxMenuItem.disabledForeground
SplitPaneDivider.border
inactiveCaptionBorder
RootPane.informationDialogBorder
FileChooser.usesSingleFilePane
PasswordField.selectionBackground
TextArea.border
ScrollBarUI
MenuBar.font
MenuBar.foreground
windowBorder
Button.rollover
InternalFrame.borderLight
TabbedPane.borderHightlightColor
Slider.highlight
List.focusInputMap
RootPane.questionDialogBorder
PopupMenuSeparatorUI
InternalFrame.borderDarkShadow
OptionPane.foreground
TextArea.caretForeground
InternalFrame.inactiveTitleForeground
TabbedPane.shadow
TextArea.selectionBackground
Menu.opaque
Spinner.arrowButtonBorder
TabbedPane.tabsOpaque
MenuItem.margin
InternalFrameTitlePane.maximizeButtonOpacity
PopupMenu.background
ProgressBar.selectionForeground
textHighlightText
InternalFrame.iconifyIcon
textHighlight
ComboBox.foreground
SplitPane.ancestorInputMap
Tree.leafIcon
SplitPaneUI
DesktopIcon.background
FileChooserUI
List.foreground
PopupMenu.popupSound
SplitPane.centerOneTouchButtons
PasswordField.echoChar
OptionPane.messageAreaBorder
Button.font
MenuItem.acceleratorSelectionForeground
ToggleButton.margin
MenuItem.commandSound
Button.shadow
ProgressBar.horizontalSize
ColorChooser.swatchesDefaultRecentColor
SplitPaneDivider.draggingColor
FormattedTextField.inactiveForeground
TableUI
Table.ascendingSortIcon
Button.light
Slider.focusInputMap
ScrollBar.shadow
Menu.arrowIcon
TextPane.background
Table.ancestorInputMap.RightToLeft
ToolTip.foreground
Table.selectionForeground
Spinner.background
ComboBox.ancestorInputMap
MenuItem.border
Menu.menuPopupOffsetX
CheckBoxMenuItem.borderPainted
Button.disabledToolBarBorderBackground
DesktopPaneUI
Menu.menuPopupOffsetY
List.timeFactor
LabelUI
ComboBoxUI
ToolTip.foregroundInactive
Desktop.background
RadioButton.focusInputMap
TabbedPane.contentBorderInsets
ColorChooser.swatchesSwatchSize
TextArea.font
PasswordFieldUI
Table.dropCellBackground
TableHeader.focusCellBackground
ProgressBar.cellLength
TableHeaderUI
Spinner.border
ComboBox.font
ScrollPane.background
TabbedPane.unselectedBackground
controlText
FileChooser.readOnly
Tree.timeFactor
ComboBox.timeFactor
Button.select
RadioButton.highlight
AATextInfoPropertyKey
ToolBar.highlight
FileChooser.upFolderIcon
ScrollBar.thumbShadow
TitledBorder.border
Label.font
PasswordField.inactiveForeground
ProgressBar.verticalSize
ToolBar.separatorSize
ScrollBar.thumbDarkShadow
TabbedPane.tabsOverlapBorder
Tree.font
CheckBox.gradient
DesktopIcon.foreground
ScrollBar.track
RadioButton.shadow
Tree.selectionBackground
TabbedPane.selectionFollowsFocus
SplitPane.background
Slider.horizontalSize
TabbedPane.selectedTabPadInsets
TabbedPane.textIconGap
List.focusCellHighlightBorder
ToolBar.borderColor
Button.focus
MenuBar.background
Tree.textBackground
Slider.majorTickLength
windowText
MenuUI
Separator.highlight
TextField.foreground
Button.gradient
TabbedPane.tabAreaInsets
CheckBox.border
ToolTipManager.enableToolTipMode
AuditoryCues.defaultCueList
Spinner.ancestorInputMap
EditorPane.font
RadioButtonMenuItem.margin
Menu.foreground
CheckBoxMenuItem.selectionBackground
EditorPane.foreground
RadioButton.border
Slider.verticalThumbIcon
ColorChooser.background
Table.focusCellForeground
TextPane.inactiveForeground
Menu.border
RootPane.plainDialogBorder
SpinnerUI
Button.focusInputMap
FileChooser.newFolderIcon
OptionPane.buttonClickThreshhold
ToolBar.foreground
RadioButton.totalInsets
Table.dropLineShortColor
Menu.font
PasswordField.caretForeground
TextArea.background
PasswordField.foreground
OptionPane.warningDialog.titlePane.foreground
Button.background
RadioButtonMenuItem.acceleratorSelectionForeground
CheckBoxMenuItemUI
CheckBox.focus
Menu.shortcutKeys
ToolBarUI
FormattedTextField.margin
OptionPane.errorDialog.titlePane.background
TabbedPane.light
PopupMenu.selectedWindowInputMapBindings
PasswordField.margin
SplitPane.dividerSize
Label.disabledForeground
TextField.darkShadow
ScrollPane.ancestorInputMap.RightToLeft
List.selectionBackground
List.cellRenderer
TextPane.selectionForeground
ToggleButton.highlight
RadioButton.disabledText
CheckBoxMenuItem.margin
TextPane.caretForeground
EditorPaneUI
TextField.shadow
TextField.selectionBackground
OptionPane.questionIcon
DesktopIcon.border
ComboBox.selectionBackground
CheckBox.textShiftOffset
CheckBoxMenuItem.font
InternalFrameTitlePane.iconifyButtonOpacity
Button.foreground
Viewport.background
Label.foreground
FileView.computerIcon
Label.disabledShadow
FormattedTextField.inactiveBackground
ToggleButton.background
Tree.collapsedIcon
OptionPane.questionDialog.titlePane.shadow
MenuItem.selectionForeground
FileChooser.homeFolderIcon
OptionPane.warningDialog.titlePane.shadow
TextField.margin
ToggleButton.border
InternalFrame.activeTitleBackground
FormattedTextFieldUI
controlLtHighlight
Tree.line
CheckBoxMenuItem.checkIcon
CheckBox.totalInsets
TitledBorder.font
MenuItem.background
ToggleButton.textShiftOffset
Tree.focusInputMap.RightToLeft
RootPane.fileChooserDialogBorder
OptionPane.messageForeground
Tree.scrollsOnExpand
MenuItem.borderPainted
Menu.cancelMode
CheckBoxMenuItem.gradient
Menu.checkIcon
PasswordField.focusInputMap
Slider.gradient
Spinner.arrowButtonSize
Tree.paintLines
FormattedTextField.foreground
CheckBoxMenuItem.border
Button.toolBarBorderBackground
TabbedPane.background
FormattedTextField.caretBlinkRate
window
EditorPane.selectionForeground
activeCaption
TextField.font
TabbedPane.labelShift
PopupMenu.border
ViewportUI
PasswordField.inactiveBackground
Tree.lineTypeDashed
FormattedTextField.selectionBackground
RadioButtonMenuItemUI
EditorPane.caretForeground
FileView.floppyDriveIcon
RadioButtonMenuItem.borderPainted
ToolBar.border
TabbedPane.foreground
TabbedPane.focusInputMap
RootPane.errorDialogBorder
InternalFrame.paletteBorder
PopupMenu.foreground
Tree.dropCellBackground
FormattedTextField.font
RadioButtonMenuItem.checkIcon
CheckBoxMenuItem.foreground
Menu.crossMenuMnemonic
activeCaptionText
OptionPane.buttonAreaBorder
TextPane.border
TextArea.selectionForeground
EditorPane.border
TextField.caretBlinkRate
TabbedPane.selectHighlight
Panel.background
TextPaneUI
Table.dropLineColor
RadioButton.light
EditorPane.caretBlinkRate
menuText
ToolBar.darkShadow
Slider.font
Tree.leftChildIndent
Menu.submenuPopupOffsetX
List.focusInputMap.RightToLeft
Menu.submenuPopupOffsetY
SeparatorUI
TextField.inactiveBackground
Separator.shadow
FormattedTextField.border
MenuBarUI
html.missingImage
OptionPane.questionDialog.titlePane.background
CheckBoxUI
TabbedPane.focus
PasswordField.background
Tree.openIcon
ColorChooserUI
Tree.dropLineColor
TabbedPane.font
Tree.focusInputMap
FileView.hardDriveIcon
PanelUI
Slider.foreground
ScrollBar.minimumThumbSize
ToolBar.rolloverBorder
CheckBox.rollover
ToolBar.ancestorInputMap
InternalFrame.closeSound
SplitPane.highlight
MenuItemUI
Slider.focusInsets
AuditoryCues.cueList
ColorChooser.font
ComboBox.disabledBackground
Tree.ancestorInputMap
ComboBox.noActionOnKeyNavigation
EditorPane.selectionBackground
Menu.borderPainted
Spinner.foreground
ProgressBar.font
DesktopIconUI
ScrollPane.font
SplitPane.shadow
ComboBox.buttonBackground
RadioButton.icon
RadioButtonMenuItem.foreground
RadioButton.textShiftOffset
Slider.minimumHorizontalSize
CheckBoxMenuItem.selectionForeground
ToggleButton.focusInputMap
Slider.background
Button.rolloverIconType
ScrollBar.background
ToggleButton.gradient
OptionPane.errorDialog.titlePane.foreground
Table.descendingSortIcon
RootPane.ancestorInputMap
Slider.focusInputMap.RightToLeft
PasswordField.selectionForeground
TableHeader.cellBorder
TabbedPane.ancestorInputMap
SplitPane.oneTouchButtonsOpaque
ToolTip.borderInactive
RadioButton.background
CheckBox.margin
MenuBar.highlight
Spinner.editorAlignment
ScrollBar.highlight
ToolBar.dockingBackground
CheckBox.font
controlHighlight
Tree.foreground
Table.background
InternalFrame.closeIcon
ScrollBar.maximumThumbSize
RadioButtonMenuItem.acceleratorFont
PopupMenu.consumeEventOnClose
Desktop.ancestorInputMap
RadioButton.select
Table.selectionBackground
Slider.verticalSize
Table.scrollPaneBorder
PopupMenuUI
SliderUI
Menu.disabledForeground
List.font
ProgressBarUI
InternalFrame.minimizeIcon
AuditoryCues.allAuditoryCues
MenuItem.arrowIcon
MenuItem.acceleratorForeground
TabbedPane.tabRunOverlay
PopupMenu.selectedWindowInputMapBindings.RightToLeft
TableHeader.foreground
TableHeader.ancestorInputMap
Tree.hash
scrollbar
ScrollBar.allowsAbsolutePositioning
RootPaneUI
TextAreaUI
ToggleButton.font
CheckBox.background
OptionPane.warningSound
TextArea.margin
ProgressBar.selectionBackground
ToolBar.shadow
SplitPane.darkShadow
TitledBorder.titleColor
InternalFrameTitlePane.closeButtonOpacity
ScrollBar.width
textText
MenuBar.borderColor
ColorChooser.swatchesRecentSwatchSize
TextArea.inactiveForeground
OptionPane.questionSound
CheckBoxMenuItem.background
OptionPane.questionDialog.titlePane.foreground
Viewport.font
ScrollBar.ancestorInputMap.RightToLeft
CheckBoxMenuItem.acceleratorFont
ToggleButton.focus
Button.defaultButtonFollowsFocus
RootPane.defaultButtonWindowKeyBindings
TextPane.foreground
ToolBar.floatingForeground
Button.darkShadow
InternalFrame.optionDialogBorder
html.pendingImage
Tree.drawsFocusBorderAroundIcon
641
UIManager keys and values list:
For most of them, values will be null. Below 60 keys only have the valid values.ListUI - javax.swing.plaf.basic.BasicListUI TabbedPaneUI - javax.swing.plaf.metal.MetalTabbedPaneUI InternalFrameUI - javax.swing.plaf.metal.MetalInternalFrameUI InternalFrame.restoreUpSound - sounds/FrameRestoreUp.wav OptionPane.informationSound - sounds/OptionPaneInformation.wav ButtonUI - javax.swing.plaf.metal.MetalButtonUI OptionPaneUI - javax.swing.plaf.basic.BasicOptionPaneUI TreeUI - javax.swing.plaf.metal.MetalTreeUI OptionPane.errorSound - sounds/OptionPaneError.wav InternalFrame.restoreDownSound - sounds/FrameRestoreDown.wav ToolTipUI - javax.swing.plaf.metal.MetalToolTipUI InternalFrame.minimizeSound - sounds/FrameMinimize.wav ScrollPaneUI - javax.swing.plaf.metal.MetalScrollPaneUI RadioButtonUI - javax.swing.plaf.metal.MetalRadioButtonUI CheckBoxMenuItem.commandSound - sounds/MenuItemCommand.wav MenuItem.acceleratorDelimiter - - ToolBarSeparatorUI - javax.swing.plaf.basic.BasicToolBarSeparatorUI ToggleButtonUI - javax.swing.plaf.metal.MetalToggleButtonUI TextFieldUI - javax.swing.plaf.metal.MetalTextFieldUI RadioButtonMenuItem.commandSound - sounds/MenuItemCommand.wav InternalFrame.maximizeSound - sounds/FrameMaximize.wav ScrollBarUI - javax.swing.plaf.metal.MetalScrollBarUI PopupMenuSeparatorUI - javax.swing.plaf.metal.MetalPopupMenuSeparatorUI SplitPaneUI - javax.swing.plaf.metal.MetalSplitPaneUI FileChooserUI - javax.swing.plaf.metal.MetalFileChooserUI PopupMenu.popupSound - sounds/PopupMenuPopup.wav MenuItem.commandSound - sounds/MenuItemCommand.wav TableUI - javax.swing.plaf.basic.BasicTableUI DesktopPaneUI - javax.swing.plaf.basic.BasicDesktopPaneUI LabelUI - javax.swing.plaf.metal.MetalLabelUI ComboBoxUI - javax.swing.plaf.metal.MetalComboBoxUI PasswordFieldUI - javax.swing.plaf.basic.BasicPasswordFieldUI TableHeaderUI - javax.swing.plaf.basic.BasicTableHeaderUI MenuUI - javax.swing.plaf.basic.BasicMenuUI ToolTipManager.enableToolTipMode - activeApplication SpinnerUI - javax.swing.plaf.basic.BasicSpinnerUI CheckBoxMenuItemUI - javax.swing.plaf.basic.BasicCheckBoxMenuItemUI ToolBarUI - javax.swing.plaf.metal.MetalToolBarUI EditorPaneUI - javax.swing.plaf.basic.BasicEditorPaneUI FormattedTextFieldUI - javax.swing.plaf.basic.BasicFormattedTextFieldUI Menu.cancelMode - hideLastSubmenu ViewportUI - javax.swing.plaf.basic.BasicViewportUI RadioButtonMenuItemUI - javax.swing.plaf.basic.BasicRadioButtonMenuItemUI TextPaneUI - javax.swing.plaf.basic.BasicTextPaneUI SeparatorUI - javax.swing.plaf.metal.MetalSeparatorUI MenuBarUI - javax.swing.plaf.metal.MetalMenuBarUI CheckBoxUI - javax.swing.plaf.metal.MetalCheckBoxUI ColorChooserUI - javax.swing.plaf.basic.BasicColorChooserUI PanelUI - javax.swing.plaf.basic.BasicPanelUI InternalFrame.closeSound - sounds/FrameClose.wav MenuItemUI - javax.swing.plaf.basic.BasicMenuItemUI DesktopIconUI - javax.swing.plaf.metal.MetalDesktopIconUI Button.rolloverIconType - ocean PopupMenuUI - javax.swing.plaf.basic.BasicPopupMenuUI SliderUI - javax.swing.plaf.metal.MetalSliderUI ProgressBarUI - javax.swing.plaf.metal.MetalProgressBarUI RootPaneUI - javax.swing.plaf.metal.MetalRootPaneUI TextAreaUI - javax.swing.plaf.basic.BasicTextAreaUI OptionPane.warningSound - sounds/OptionPaneWarning.wav OptionPane.questionSound - sounds/OptionPaneQuestion.wav
Java 8 program to get the keys list:
javax.swing.UIManager.getDefaults().keys().toList().toSorted().each {println it};
No comments:
Post a Comment
Please do not add any spam links in the comments section.