Diferencia entre revisiones de «UIManager: Cambiar colores por defecto de ventanas java»

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

Revisión del 07:51 4 feb 2007

UIManager

UIManager es una clase java que contiene mucha de la información que necesita java para construir los botones, ventanas y demás.

Entre otras cosas, tiene almacenado dentro cuáles son los colores por defecto que tendrá cada uno de los componentes java. El color de fondo de botones, checkbox, pestañas, etc.

Podemos fácilmente cambiar esos colores. El siguiente trocito de código hará que a partir de ese momento todos los botones que instanciemos tengan color blanco

UIManager.put("Button.background", Color.white);

Basta con llamar al método put() y fijar una propiedad "Button.background" con el color que quermos.


Obtener las propiedades de UIManager

Para cambiar otros colores de otros componentes necesitaremos saber el nombre de la propiedad de ese color y componente en concreto. ¿Cómo sabemos los nombres de las propiedades de UIManager?. En la API de java no aparece una lista de dichas propiedades, pero este pequeño código nos puede ayudar a obtenerlas:

UIDefaults d = UIManager.getDefaults();
Enumeration<Object> claves = d.keys();
while (claves.hasMoreElements())
   System.out.println(claves.nextElement());

que nos dará el siguiente listado (java 1.5)

class javax.swing.plaf.basic.BasicPanelUI
javax.swing.plaf.basic.BasicPanelUI
class javax.swing.plaf.metal.MetalRootPaneUI
Button.background
class javax.swing.plaf.metal.MetalButtonUI
javax.swing.plaf.metal.MetalButtonUI
javax.swing.plaf.metal.MetalRootPaneUI
TextPane.font
Label.background
OptionPane.warningDialog.titlePane.shadow
ToolTip.foregroundInactive
ToolBar.separatorSize
TabbedPane.tabAreaInsets
FileView.floppyDriveIcon
RootPane.informationDialogBorder
...

No están todas, que son muchas, muchas.