Skip to content

Instantly share code, notes, and snippets.

@itzg
Last active November 12, 2021 20:34
Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save itzg/5938035 to your computer and use it in GitHub Desktop.
Save itzg/5938035 to your computer and use it in GitHub Desktop.
Java Swing UIDefaults keys
import java.util.Enumeration;
import java.util.SortedSet;
import java.util.TreeSet;
import javax.swing.UIDefaults;
import javax.swing.UIManager;
public class ListUIDefaultsKeys {
public static void main(String args[]) throws Exception {
UIManager.LookAndFeelInfo looks[] = UIManager
.getInstalledLookAndFeels();
SortedSet<String> lafDefaultKeys = new TreeSet<>();
for (UIManager.LookAndFeelInfo info : looks) {
System.out.println("Including L&F "+info.getName());
UIDefaults defaults = UIManager.getDefaults();
Enumeration<Object> newKeys = defaults.keys();
while (newKeys.hasMoreElements()) {
lafDefaultKeys.add(newKeys.nextElement().toString());
}
}
System.out.println();
System.out.println("================== UIDefaults Keys ==================");
for (String key : lafDefaultKeys) {
System.out.println(key);
}
}
}

Code was derived from here

Including L&F Metal
Including L&F Nimbus
Including L&F CDE/Motif
Including L&F Windows
Including L&F Windows Classic
================== UIDefaults Keys ==================
AATextInfoPropertyKey
AuditoryCues.allAuditoryCues
AuditoryCues.cueList
AuditoryCues.defaultCueList
AuditoryCues.noAuditoryCues
Button.background
Button.border
Button.darkShadow
Button.defaultButtonFollowsFocus
Button.disabledText
Button.disabledToolBarBorderBackground
Button.focus
Button.focusInputMap
Button.font
Button.foreground
Button.gradient
Button.highlight
Button.light
Button.margin
Button.rollover
Button.rolloverIconType
Button.select
Button.shadow
Button.textIconGap
Button.textShiftOffset
Button.toolBarBorderBackground
ButtonUI
CheckBox.background
CheckBox.border
CheckBox.disabledText
CheckBox.focus
CheckBox.focusInputMap
CheckBox.font
CheckBox.foreground
CheckBox.gradient
CheckBox.icon
CheckBox.margin
CheckBox.rollover
CheckBox.textIconGap
CheckBox.textShiftOffset
CheckBox.totalInsets
CheckBoxMenuItem.acceleratorFont
CheckBoxMenuItem.acceleratorForeground
CheckBoxMenuItem.acceleratorSelectionForeground
CheckBoxMenuItem.arrowIcon
CheckBoxMenuItem.background
CheckBoxMenuItem.border
CheckBoxMenuItem.borderPainted
CheckBoxMenuItem.checkIcon
CheckBoxMenuItem.commandSound
CheckBoxMenuItem.disabledForeground
CheckBoxMenuItem.font
CheckBoxMenuItem.foreground
CheckBoxMenuItem.gradient
CheckBoxMenuItem.margin
CheckBoxMenuItem.selectionBackground
CheckBoxMenuItem.selectionForeground
CheckBoxMenuItemUI
CheckBoxUI
Checkbox.select
ColorChooser.background
ColorChooser.font
ColorChooser.foreground
ColorChooser.swatchesDefaultRecentColor
ColorChooser.swatchesRecentSwatchSize
ColorChooser.swatchesSwatchSize
ColorChooserUI
ComboBox.ancestorInputMap
ComboBox.background
ComboBox.buttonBackground
ComboBox.buttonDarkShadow
ComboBox.buttonHighlight
ComboBox.buttonShadow
ComboBox.disabledBackground
ComboBox.disabledForeground
ComboBox.font
ComboBox.foreground
ComboBox.isEnterSelectablePopup
ComboBox.selectionBackground
ComboBox.selectionForeground
ComboBox.timeFactor
ComboBoxUI
Desktop.ancestorInputMap
Desktop.background
Desktop.minOnScreenInsets
DesktopIcon.background
DesktopIcon.border
DesktopIcon.font
DesktopIcon.foreground
DesktopIcon.width
DesktopIconUI
DesktopPaneUI
EditorPane.background
EditorPane.border
EditorPane.caretBlinkRate
EditorPane.caretForeground
EditorPane.focusInputMap
EditorPane.font
EditorPane.foreground
EditorPane.inactiveForeground
EditorPane.margin
EditorPane.selectionBackground
EditorPane.selectionForeground
EditorPaneUI
FileChooser.ancestorInputMap
FileChooser.detailsViewIcon
FileChooser.fileNameLabelMnemonic
FileChooser.filesOfTypeLabelMnemonic
FileChooser.homeFolderIcon
FileChooser.listViewIcon
FileChooser.lookInLabelMnemonic
FileChooser.newFolderIcon
FileChooser.readOnly
FileChooser.upFolderIcon
FileChooser.useSystemExtensionHiding
FileChooser.usesSingleFilePane
FileChooserUI
FileView.computerIcon
FileView.directoryIcon
FileView.fileIcon
FileView.floppyDriveIcon
FileView.hardDriveIcon
FormattedTextField.background
FormattedTextField.border
FormattedTextField.caretBlinkRate
FormattedTextField.caretForeground
FormattedTextField.focusInputMap
FormattedTextField.font
FormattedTextField.foreground
FormattedTextField.inactiveBackground
FormattedTextField.inactiveForeground
FormattedTextField.margin
FormattedTextField.selectionBackground
FormattedTextField.selectionForeground
FormattedTextFieldUI
InternalFrame.activeTitleBackground
InternalFrame.activeTitleForeground
InternalFrame.activeTitleGradient
InternalFrame.border
InternalFrame.borderColor
InternalFrame.borderDarkShadow
InternalFrame.borderHighlight
InternalFrame.borderLight
InternalFrame.borderShadow
InternalFrame.closeIcon
InternalFrame.closeSound
InternalFrame.icon
InternalFrame.iconifyIcon
InternalFrame.inactiveTitleBackground
InternalFrame.inactiveTitleForeground
InternalFrame.maximizeIcon
InternalFrame.maximizeSound
InternalFrame.minimizeIcon
InternalFrame.minimizeSound
InternalFrame.optionDialogBorder
InternalFrame.paletteBorder
InternalFrame.paletteCloseIcon
InternalFrame.paletteTitleHeight
InternalFrame.restoreDownSound
InternalFrame.restoreUpSound
InternalFrame.titleFont
InternalFrameTitlePane.closeButtonOpacity
InternalFrameTitlePane.iconifyButtonOpacity
InternalFrameTitlePane.maximizeButtonOpacity
InternalFrameUI
Label.background
Label.disabledForeground
Label.disabledShadow
Label.font
Label.foreground
LabelUI
List.background
List.cellRenderer
List.dropCellBackground
List.dropLineColor
List.focusCellHighlightBorder
List.focusInputMap
List.focusInputMap.RightToLeft
List.font
List.foreground
List.noFocusBorder
List.selectionBackground
List.selectionForeground
List.timeFactor
ListUI
Menu.acceleratorFont
Menu.acceleratorForeground
Menu.acceleratorSelectionForeground
Menu.arrowIcon
Menu.background
Menu.border
Menu.borderPainted
Menu.cancelMode
Menu.checkIcon
Menu.crossMenuMnemonic
Menu.disabledForeground
Menu.font
Menu.foreground
Menu.margin
Menu.menuPopupOffsetX
Menu.menuPopupOffsetY
Menu.opaque
Menu.preserveTopLevelSelection
Menu.selectionBackground
Menu.selectionForeground
Menu.shortcutKeys
Menu.submenuPopupOffsetX
Menu.submenuPopupOffsetY
MenuBar.background
MenuBar.border
MenuBar.borderColor
MenuBar.font
MenuBar.foreground
MenuBar.gradient
MenuBar.highlight
MenuBar.shadow
MenuBar.windowBindings
MenuBarUI
MenuItem.acceleratorDelimiter
MenuItem.acceleratorFont
MenuItem.acceleratorForeground
MenuItem.acceleratorSelectionForeground
MenuItem.arrowIcon
MenuItem.background
MenuItem.border
MenuItem.borderPainted
MenuItem.checkIcon
MenuItem.commandSound
MenuItem.disabledForeground
MenuItem.font
MenuItem.foreground
MenuItem.margin
MenuItem.selectionBackground
MenuItem.selectionForeground
MenuItemUI
MenuUI
OptionPane.background
OptionPane.border
OptionPane.buttonAreaBorder
OptionPane.buttonClickThreshhold
OptionPane.errorDialog.border.background
OptionPane.errorDialog.titlePane.background
OptionPane.errorDialog.titlePane.foreground
OptionPane.errorDialog.titlePane.shadow
OptionPane.errorIcon
OptionPane.errorSound
OptionPane.font
OptionPane.foreground
OptionPane.informationIcon
OptionPane.informationSound
OptionPane.messageAreaBorder
OptionPane.messageForeground
OptionPane.minimumSize
OptionPane.questionDialog.border.background
OptionPane.questionDialog.titlePane.background
OptionPane.questionDialog.titlePane.foreground
OptionPane.questionDialog.titlePane.shadow
OptionPane.questionIcon
OptionPane.questionSound
OptionPane.warningDialog.border.background
OptionPane.warningDialog.titlePane.background
OptionPane.warningDialog.titlePane.foreground
OptionPane.warningDialog.titlePane.shadow
OptionPane.warningIcon
OptionPane.warningSound
OptionPane.windowBindings
OptionPaneUI
Panel.background
Panel.font
Panel.foreground
PanelUI
PasswordField.background
PasswordField.border
PasswordField.caretBlinkRate
PasswordField.caretForeground
PasswordField.echoChar
PasswordField.focusInputMap
PasswordField.font
PasswordField.foreground
PasswordField.inactiveBackground
PasswordField.inactiveForeground
PasswordField.margin
PasswordField.selectionBackground
PasswordField.selectionForeground
PasswordFieldUI
PopupMenu.background
PopupMenu.border
PopupMenu.consumeEventOnClose
PopupMenu.font
PopupMenu.foreground
PopupMenu.popupSound
PopupMenu.selectedWindowInputMapBindings
PopupMenu.selectedWindowInputMapBindings.RightToLeft
PopupMenuSeparatorUI
PopupMenuUI
ProgressBar.background
ProgressBar.border
ProgressBar.cellLength
ProgressBar.cellSpacing
ProgressBar.cycleTime
ProgressBar.font
ProgressBar.foreground
ProgressBar.horizontalSize
ProgressBar.repaintInterval
ProgressBar.selectionBackground
ProgressBar.selectionForeground
ProgressBar.verticalSize
ProgressBarUI
RadioButton.background
RadioButton.border
RadioButton.darkShadow
RadioButton.disabledText
RadioButton.focus
RadioButton.focusInputMap
RadioButton.font
RadioButton.foreground
RadioButton.gradient
RadioButton.highlight
RadioButton.icon
RadioButton.light
RadioButton.margin
RadioButton.rollover
RadioButton.select
RadioButton.shadow
RadioButton.textIconGap
RadioButton.textShiftOffset
RadioButton.totalInsets
RadioButtonMenuItem.acceleratorFont
RadioButtonMenuItem.acceleratorForeground
RadioButtonMenuItem.acceleratorSelectionForeground
RadioButtonMenuItem.arrowIcon
RadioButtonMenuItem.background
RadioButtonMenuItem.border
RadioButtonMenuItem.borderPainted
RadioButtonMenuItem.checkIcon
RadioButtonMenuItem.commandSound
RadioButtonMenuItem.disabledForeground
RadioButtonMenuItem.font
RadioButtonMenuItem.foreground
RadioButtonMenuItem.gradient
RadioButtonMenuItem.margin
RadioButtonMenuItem.selectionBackground
RadioButtonMenuItem.selectionForeground
RadioButtonMenuItemUI
RadioButtonUI
RootPane.ancestorInputMap
RootPane.colorChooserDialogBorder
RootPane.defaultButtonWindowKeyBindings
RootPane.errorDialogBorder
RootPane.fileChooserDialogBorder
RootPane.frameBorder
RootPane.informationDialogBorder
RootPane.plainDialogBorder
RootPane.questionDialogBorder
RootPane.warningDialogBorder
RootPaneUI
ScrollBar.allowsAbsolutePositioning
ScrollBar.ancestorInputMap
ScrollBar.ancestorInputMap.RightToLeft
ScrollBar.background
ScrollBar.darkShadow
ScrollBar.foreground
ScrollBar.gradient
ScrollBar.highlight
ScrollBar.maximumThumbSize
ScrollBar.minimumThumbSize
ScrollBar.shadow
ScrollBar.thumb
ScrollBar.thumbDarkShadow
ScrollBar.thumbHighlight
ScrollBar.thumbShadow
ScrollBar.track
ScrollBar.trackHighlight
ScrollBar.width
ScrollBarUI
ScrollPane.ancestorInputMap
ScrollPane.ancestorInputMap.RightToLeft
ScrollPane.background
ScrollPane.border
ScrollPane.font
ScrollPane.foreground
ScrollPaneUI
Separator.background
Separator.foreground
Separator.highlight
Separator.shadow
SeparatorUI
Slider.altTrackColor
Slider.background
Slider.focus
Slider.focusGradient
Slider.focusInputMap
Slider.focusInputMap.RightToLeft
Slider.focusInsets
Slider.font
Slider.foreground
Slider.gradient
Slider.highlight
Slider.horizontalSize
Slider.horizontalThumbIcon
Slider.majorTickLength
Slider.minimumHorizontalSize
Slider.minimumVerticalSize
Slider.onlyLeftMouseButtonDrag
Slider.shadow
Slider.tickColor
Slider.trackWidth
Slider.verticalSize
Slider.verticalThumbIcon
SliderUI
Spinner.ancestorInputMap
Spinner.arrowButtonBorder
Spinner.arrowButtonInsets
Spinner.arrowButtonSize
Spinner.background
Spinner.border
Spinner.editorAlignment
Spinner.editorBorderPainted
Spinner.font
Spinner.foreground
SpinnerUI
SplitPane.ancestorInputMap
SplitPane.background
SplitPane.border
SplitPane.centerOneTouchButtons
SplitPane.darkShadow
SplitPane.dividerFocusColor
SplitPane.dividerSize
SplitPane.highlight
SplitPane.oneTouchButtonsOpaque
SplitPane.shadow
SplitPaneDivider.border
SplitPaneDivider.draggingColor
SplitPaneUI
TabbedPane.ancestorInputMap
TabbedPane.background
TabbedPane.borderHightlightColor
TabbedPane.contentAreaColor
TabbedPane.contentBorderInsets
TabbedPane.contentOpaque
TabbedPane.darkShadow
TabbedPane.focus
TabbedPane.focusInputMap
TabbedPane.font
TabbedPane.foreground
TabbedPane.highlight
TabbedPane.labelShift
TabbedPane.light
TabbedPane.selectHighlight
TabbedPane.selected
TabbedPane.selectedLabelShift
TabbedPane.selectedTabPadInsets
TabbedPane.selectionFollowsFocus
TabbedPane.shadow
TabbedPane.tabAreaBackground
TabbedPane.tabAreaInsets
TabbedPane.tabInsets
TabbedPane.tabRunOverlay
TabbedPane.tabsOpaque
TabbedPane.tabsOverlapBorder
TabbedPane.textIconGap
TabbedPane.unselectedBackground
TabbedPaneUI
Table.ancestorInputMap
Table.ancestorInputMap.RightToLeft
Table.ascendingSortIcon
Table.background
Table.descendingSortIcon
Table.dropCellBackground
Table.dropLineColor
Table.dropLineShortColor
Table.focusCellBackground
Table.focusCellForeground
Table.focusCellHighlightBorder
Table.font
Table.foreground
Table.gridColor
Table.scrollPaneBorder
Table.selectionBackground
Table.selectionForeground
Table.sortIconColor
TableHeader.ancestorInputMap
TableHeader.background
TableHeader.cellBorder
TableHeader.focusCellBackground
TableHeader.font
TableHeader.foreground
TableHeaderUI
TableUI
TextArea.background
TextArea.border
TextArea.caretBlinkRate
TextArea.caretForeground
TextArea.focusInputMap
TextArea.font
TextArea.foreground
TextArea.inactiveForeground
TextArea.margin
TextArea.selectionBackground
TextArea.selectionForeground
TextAreaUI
TextField.background
TextField.border
TextField.caretBlinkRate
TextField.caretForeground
TextField.darkShadow
TextField.focusInputMap
TextField.font
TextField.foreground
TextField.highlight
TextField.inactiveBackground
TextField.inactiveForeground
TextField.light
TextField.margin
TextField.selectionBackground
TextField.selectionForeground
TextField.shadow
TextFieldUI
TextPane.background
TextPane.border
TextPane.caretBlinkRate
TextPane.caretForeground
TextPane.focusInputMap
TextPane.font
TextPane.foreground
TextPane.inactiveForeground
TextPane.margin
TextPane.selectionBackground
TextPane.selectionForeground
TextPaneUI
TitledBorder.border
TitledBorder.font
TitledBorder.titleColor
ToggleButton.background
ToggleButton.border
ToggleButton.darkShadow
ToggleButton.disabledText
ToggleButton.focus
ToggleButton.focusInputMap
ToggleButton.font
ToggleButton.foreground
ToggleButton.gradient
ToggleButton.highlight
ToggleButton.light
ToggleButton.margin
ToggleButton.select
ToggleButton.shadow
ToggleButton.textIconGap
ToggleButton.textShiftOffset
ToggleButtonUI
ToolBar.ancestorInputMap
ToolBar.background
ToolBar.border
ToolBar.borderColor
ToolBar.darkShadow
ToolBar.dockingBackground
ToolBar.dockingForeground
ToolBar.floatingBackground
ToolBar.floatingForeground
ToolBar.font
ToolBar.foreground
ToolBar.highlight
ToolBar.isRollover
ToolBar.light
ToolBar.nonrolloverBorder
ToolBar.rolloverBorder
ToolBar.separatorSize
ToolBar.shadow
ToolBarSeparatorUI
ToolBarUI
ToolTip.background
ToolTip.backgroundInactive
ToolTip.border
ToolTip.borderInactive
ToolTip.font
ToolTip.foreground
ToolTip.foregroundInactive
ToolTip.hideAccelerator
ToolTipManager.enableToolTipMode
ToolTipUI
Tree.ancestorInputMap
Tree.background
Tree.changeSelectionWithFocus
Tree.closedIcon
Tree.collapsedIcon
Tree.drawsFocusBorderAroundIcon
Tree.dropCellBackground
Tree.dropLineColor
Tree.editorBorder
Tree.expandedIcon
Tree.focusInputMap
Tree.focusInputMap.RightToLeft
Tree.font
Tree.foreground
Tree.hash
Tree.leafIcon
Tree.leftChildIndent
Tree.line
Tree.lineTypeDashed
Tree.openIcon
Tree.paintLines
Tree.rightChildIndent
Tree.rowHeight
Tree.scrollsOnExpand
Tree.selectionBackground
Tree.selectionBorderColor
Tree.selectionForeground
Tree.textBackground
Tree.textForeground
Tree.timeFactor
TreeUI
Viewport.background
Viewport.font
Viewport.foreground
ViewportUI
activeCaption
activeCaptionBorder
activeCaptionText
control
controlDkShadow
controlHighlight
controlLtHighlight
controlShadow
controlText
desktop
html.missingImage
html.pendingImage
inactiveCaption
inactiveCaptionBorder
inactiveCaptionText
info
infoText
menu
menuText
scrollbar
text
textHighlight
textHighlightText
textInactiveText
textText
window
windowBorder
windowText
@aeris170
Copy link

aeris170 commented Mar 1, 2018

combobox dark shadow and such doesn't work :/

@kansasSamurai
Copy link

@aeris170, keys and properties are look and feel specific. This code snippet lumps together all look and feels available when run. So, for this example, they are the five(5) listed at the top (and shown below for reference). You either have to limit the code to the look and feel that you are using, or modify the code to identify which look and feel(s) the key applies to.

Including L&F Metal
Including L&F Nimbus
Including L&F CDE/Motif
Including L&F Windows
Including L&F Windows Classic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment