Cambios

De ChuWiki
Saltar a: navegación, buscar

UIManager: Cambiar colores por defecto de ventanas java

13 250 bytes eliminados, 19:34 11 mar 2015
m
Cambiar textos por defecto
 
== UIManager ==
UIManager.put("Button.background", Color.white);
Basta con llamar al método put() y fijar una propiedad "Button.background" con el color que quermosqueremos.
 
== Cambiar textos por defecto ==
 
También podemos cambiar los textos por defecto de los botones de las ventanas "prefabricadas" como [[JOptionPane y diálogos modales|JOptionPane]] o JFileChooser, por ejemplo, para ponerlos en español
 
<pre>
UIManager.put("OptionPane.yesButtonText","S\u00ED");
UIManager.put("OptionPane.noButtonText","No");
UIManager.put("OptionPane.cancelButtonText","Cancelar");
UIManager.put("OptionPane.okButtonText","Aceptar");
</pre>
== Obtener las propiedades de UIManager ==
FileView.floppyDriveIcon
RootPane.informationDialogBorder
EditorPane.foregroundRootPane.errorDialogBorderSplitPane.darkShadowToggleButton.fontSplitPane.backgroundToolTip.borderSlider.verticalSizeTree.openIconFileView.computerIconscrollbarInternalFrame.optionDialogBorderMenuBarUITabbedPane.tabsOverlapBorderScrollPane.foregroundTitledBorder.borderSlider.tickColorTree.textBackgroundToggleButtonUIInternalFrame.minimizeSoundRadioButton.focusInputMapMenu.crossMenuMnemonicSplitPane.centerOneTouchButtonsInternalFrame.restoreDownSoundTree.selectionBackgroundOptionPane.buttonAreaBorderScrollBar.gradientRootPane.ancestorInputMapMenu.selectionBackgroundTabbedPane.ancestorInputMapFileChooser.fileNameLabelMnemonicScrollBar.thumbDarkShadowtextTextTextArea.borderScrollBar.darkShadowScrollBar.backgroundTextField.borderComboBox.buttonDarkShadowTextField.caretForegroundComboBox.buttonBackgroundComboBox.buttonHighlightTextField.inactiveBackgroundDesktopIcon.widthCheckBoxMenuItem.acceleratorFontCheckBoxUIPasswordField.marginTable.focusCellForegroundTextField.shadowComboBox.selectionBackgroundMenu.checkIconColorChooserUIRootPaneUIMenu.acceleratorSelectionForegroundMenuBar.gradientRadioButton.focusFileChooser.upFolderIconToggleButton.disabledTextPopupMenu.selectedWindowInputMapBindingsRadioButton.lightSplitPaneUITextField.focusInputMapTable.ancestorInputMapTable.selectionBackgroundRootPane.questionDialogBorderTree.scrollsOnExpandList.cellRendererMenuItem.acceleratorSelectionForegroundactiveCaptionBorderPanel.fontCheckBoxMenuItem.acceleratorSelectionForegroundTextPane.borderFormattedTextField.inactiveForegroundMenuBar.borderColorRadioButton.marginTextFieldUITabbedPane.focusInputMapButton.disabledToolBarBorderBackgroundCheckBox.marginFormattedTextField.caretBlinkRateTableUIOptionPane.messageForegroundList.foregroundTable.foregroundPopupMenu.popupSoundTable.ancestorInputMap.RightToLeftTabbedPane.tabRunOverlayTable.focusCellHighlightBorderToggleButton.gradientcontrolDkShadowColorChooser.foregroundRadioButton.iconTabbedPane.tabAreaBackgroundInternalFrame.borderDarkShadowMenuBar.backgroundLabel.disabledForegroundInternalFrame.inactiveTitleBackgroundTable.scrollPaneBorderSeparator.backgroundToggleButton.selectFormattedTextField.selectionForegroundPasswordField.inactiveForegroundRadioButtonMenuItem.borderInternalFrame.activeTitleGradientMenuItem.foregroundButton.marginRadioButtonMenuItem.arrowIconOptionPane.warningDialog.titlePane.backgroundTextArea.caretBlinkRateCheckBoxMenuItem.disabledForegroundOptionPane.warningDialog.border.backgroundPopupMenu.fontOptionPane.fontTabbedPane.tabInsetsViewportUISpinner.backgroundInternalFrame.maximizeSoundInternalFrame.titleFontViewport.foregroundButton.foregroundOptionPane.backgroundProgressBar.cellLengthProgressBar.repaintIntervalButtonUITree.hashOptionPane.errorSoundLabel.fontTextArea.caretForegroundSplitPaneDivider.draggingColorOptionPane.errorDialog.titlePane.backgroundDesktop.ancestorInputMapTextArea.inactiveForegroundcontrolHighlightTextField.caretBlinkRateTextArea.selectionBackgroundButton.defaultButtonFollowsFocusToolTip.backgroundMenuItem.acceleratorForegroundTree.fontTabbedPane.focusTabbedPane.lightScrollPane.fontRadioButton.darkShadowToolBar.isRolloverFileChooserUIInternalFrame.activeTitleBackgroundMenuItem.disabledForegroundOptionPane.minimumSizeToggleButton.darkShadowDesktopIcon.backgroundToggleButton.textShiftOffsetSpinner.ancestorInputMapToggleButton.backgroundList.focusCellHighlightBorderSlider.backgroundRadioButtonMenuItem.borderPaintedEditorPane.selectionBackgroundMenu.backgroundPasswordField.selectionForegroundRadioButton.textShiftOffsetRadioButton.backgroundOptionPane.errorIconRootPane.fileChooserDialogBorderCheckBox.backgroundRadioButtonMenuItemUIinactiveCaptionBorderDesktopIconUIToolBar.floatingForegroundProgressBar.foregroundToolBar.darkShadowinactiveCaptionMenuItem.marginRadioButtonMenuItem.foregroundMenu.opaqueToolBar.backgroundCheckBox.iconPasswordField.backgroundToolTip.borderInactiveToolTip.backgroundInactiveInternalFrame.borderShadowScrollBar.thumbSplitPane.borderTextField.darkShadowTextField.selectionForegroundRadioButton.rolloverTextPane.focusInputMapTabbedPane.contentAreaColorRadioButtonMenuItem.gradientMenuItem.acceleratorFontProgressBar.borderScrollBar.minimumThumbSizeFormattedTextFieldUITabbedPane.foregroundOptionPane.informationSoundMenu.marginProgressBarUISplitPane.shadowTextField.backgroundRadioButtonMenuItem.selectionForegroundInternalFrame.paletteBorderSpinner.arrowButtonSizeTextField.fontOptionPane.errorDialog.titlePane.shadowwindowtextInactiveTextViewport.fontList.timeFactorFileChooser.filesOfTypeLabelMnemonicCheckBoxMenuItem.arrowIconToolBar.lightToggleButton.highlightComboBox.foregroundTableHeader.foregroundEditorPane.inactiveForegroundScrollBar.shadowSlider.verticalThumbIconMenuItem.arrowIconTree.editorBorderCheckBox.disabledTextMenuBar.fontButton.textIconGaptextMenu.disabledForegroundInternalFrame.closeIconFileView.fileIconSlider.minimumHorizontalSizeEditorPaneUIButton.textShiftOffsetInternalFrame.borderHighlightPopupMenu.selectedWindowInputMapBindings.RightToLeftToolBar.borderTree.leafIconTextPane.caretBlinkRateFormattedTextField.backgroundTextArea.backgroundTabbedPane.unselectedBackgroundPasswordField.borderFileChooser.useSystemExtensionHidingProgressBar.selectionForegroundEditorPane.caretForegroundSpinner.borderToolBar.shadowToolBar.nonrolloverBorderInternalFrame.maximizeIconToolTip.hideAcceleratorButton.disabledTextFormattedTextField.fontTree.foregroundButton.focusToggleButton.focusInputMapTabbedPane.selectedTabPadInsetsButton.lightOptionPane.questionDialog.border.backgroundSpinner.arrowButtonBorderDesktopIcon.fontOptionPane.questionDialog.titlePane.backgroundmenuPopupMenu.backgroundTabbedPane.borderHightlightColorRadioButton.borderComboBox.disabledBackgroundTableHeader.fontInternalFrame.paletteCloseIconMenuBar.borderCheckBox.borderCheckBoxMenuItem.marginCheckBox.textShiftOffsetTabbedPaneUICheckBoxMenuItem.backgroundPanel.backgroundToolTipUIRadioButton.shadowTree.drawsFocusBorderAroundIconwindowTextTextPane.selectionBackgroundTree.collapsedIconFileChooser.readOnlyList.focusInputMap.RightToLeftInternalFrame.borderLightButton.borderEditorPane.backgroundMenu.menuPopupOffsetYMenuBar.shadowTree.rowHeightMenu.menuPopupOffsetXFileChooser.lookInLabelMnemoniccontrolComboBox.buttonShadowScrollBar.highlightcontrolShadowCheckBoxMenuItem.selectionForegroundTableHeaderUIButton.toolBarBorderBackgroundinfoScrollPane.backgroundButton.shadowTabbedPane.contentOpaquePopupMenuUIinfoTextCheckBox.focuscontrolLtHighlightToolBar.dockingForegroundTable.gridColorOptionPaneUIFileView.hardDriveIconOptionPane.informationIconRadioButtonMenuItem.checkIconToggleButton.focusPopupMenu.consumeEventOnCloseFormattedTextField.focusInputMapMenuUIPasswordField.caretBlinkRateSpinner.editorBorderPaintedScrollBarUIToggleButton.lightMenuItem.acceleratorDelimiterAuditoryCues.cueListDesktopPaneUIInternalFrame.minimizeIconTextField.highlightFileChooser.ancestorInputMapInternalFrame.borderMenuItemUIScrollBar.allowsAbsolutePositioningEditorPane.marginComboBox.timeFactorRadioButton.disabledTextProgressBar.verticalSizeToolTip.fontTextPane.foregroundMenu.borderPaintedmenuTextMenuItem.selectionForegroundOptionPane.windowBindingsTable.focusCellBackgroundScrollBar.maximumThumbSizeProgressBar.cycleTimeToolBarUIPopupMenu.borderList.selectionForegroundSlider.horizontalSizeactiveCaptionLabel.foregroundPasswordField.fontSplitPane.oneTouchButtonsOpaqueInternalFrame.iconifyIconSlider.gradientScrollBar.trackHighlightactiveCaptionTexttextHighlightTextScrollPane.ancestorInputMapRadioButtonMenuItem.disabledForegroundLabel.disabledShadowComboBoxUITabbedPane.contentBorderInsetsTree.textForegroundMenuItem.borderPasswordFieldUITextArea.focusInputMapMenu.selectionForegroundButton.highlightSpinnerUIScrollBar.trackList.backgroundFormattedTextField.marginRadioButtonMenuItem.acceleratorSelectionForegroundFormattedTextField.inactiveBackgroundSlider.highlightScrollBar.foregroundColorChooser.backgroundTree.selectionForegroundSlider.focusInputMapTabbedPane.tabsOpaqueTable.fontTabbedPane.fontToggleButton.marginTable.backgroundInternalFrameUITextField.inactiveForegroundMenu.borderCheckBoxMenuItemUICheckBox.focusInputMapTree.timeFactorPasswordField.focusInputMapFormattedTextField.selectionBackgroundToolBarSeparatorUISlider.altTrackColorToolBar.rolloverBorderPasswordField.inactiveBackgroundMenuItem.backgroundProgressBar.fontEditorPane.caretBlinkRateButton.gradientCheckBoxMenuItem.fontOptionPane.messageAreaBorderComboBox.selectionForegroundTree.focusInputMap.RightToLeftCheckBoxMenuItem.acceleratorForegroundCheckBoxMenuItem.checkIconMenu.shortcutKeysButton.rolloverIconTypeTree.selectionBorderColorDesktopIcon.borderCheckBox.gradientButton.darkShadowViewport.backgroundMenuItem.checkIconcontrolTextProgressBar.cellSpacingTable.selectionForegroundMenuItem.commandSoundScrollPaneUISlider.focusInputMap.RightToLeftSlider.shadowEditorPane.focusInputMapSplitPane.dividerSizeButton.backgroundColorChooser.fontSeparator.highlightProgressBar.horizontalSizeColorChooser.swatchesDefaultRecentColorDesktop.backgroundFileChooser.detailsViewIconTabbedPane.textIconGapRadioButton.selectTableHeader.cellBorderScrollPane.ancestorInputMap.RightToLeftTree.paintLinesTextPane.inactiveForegroundButton.fonttextHighlightFileChooser.usesSingleFilePaneSplitPane.dividerFocusColorwindowBorderMenuBar.foregroundInternalFrame.inactiveTitleForegroundSeparator.foregroundTabbedPane.highlightSplitPaneDivider.borderMenuBar.windowBindingsCheckBox.textIconGapTextArea.fontPasswordField.selectionBackgroundSpinner.fontOptionPane.warningDialog.titlePane.foregroundSpinner.foregroundButton.selectTextPane.caretForegroundRadioButtonMenuItem.acceleratorFontCheckBoxMenuItem.borderRadioButton.fontTitledBorder.fontOptionPane.foregroundToolBar.floatingBackgroundProgressBar.backgroundTabbedPane.shadowSpinner.arrowButtonInsetsAuditoryCues.allAuditoryCuesTabbedPane.selectHighlightTextField.lightEditorPane.fontList.focusInputMapSlider.focusPopupMenuSeparatorUITree.leftChildIndentRadioButtonMenuItem.backgroundTabbedPane.darkShadowOptionPane.errorDialog.titlePane.foregroundTabbedPane.backgroundMenu.acceleratorForegroundPanelUITextField.selectionBackgroundSlider.majorTickLengthTextArea.marginRadioButtonMenuItem.selectionBackgroundTextField.marginTree.lineTextArea.selectionForegroundScrollBar.thumbShadowToolTip.foregroundMenu.arrowIconOptionPane.warningSoundInternalFrame.activeTitleForegroundComboBox.backgroundDesktopIcon.foregroundTableHeader.backgroundTitledBorder.titleColorCheckbox.selectMenu.foregroundRadioButtonMenuItem.fontdesktopButton.actionMapCheckBoxMenuItem.commandSoundRadioButton.foregroundToolBar.fontToggleButton.foregroundRootPane.plainDialogBorderCheckBoxMenuItem.gradientSlider.foregroundMenuItem.fontEditorPane.selectionForegroundTree.rightChildIndentRootPane.colorChooserDialogBorderSeparatorUIOptionPane.questionSoundRadioButtonMenuItem.commandSoundToolBar.foregroundSlider.focusInsetsEditorPane.borderPasswordField.foregroundInternalFrame.paletteTitleHeightSlider.minimumVerticalSizeCheckBox.foregroundMenu.submenuPopupOffsetYMenu.submenuPopupOffsetXTextPane.marginTree.focusInputMapTabbedPane.selectedTextAreaUILabelUIOptionPane.warningIconRadioButtonMenuItem.acceleratorForegroundInternalFrame.restoreUpSoundTree.changeSelectionWithFocusTreeUITextField.foregroundinactiveCaptionTextProgressBar.selectionBackgroundOptionPane.buttonClickThreshholdToolBar.borderColorColorChooser.swatchesRecentSwatchSizeScrollBar.thumbHighlightScrollPane.borderRootPane.warningDialogBorderAuditoryCues.noAuditoryCuesMenuBar.highlightRadioButtonUIOptionPane.questionIconCheckBox.fontAuditoryCues.defaultCueListFormattedTextField.borderCheckBoxMenuItem.borderPaintedTree.ancestorInputMapTree.backgroundRadioButtonMenuItem.marginMenuItem.borderPaintedRootPane.defaultButtonWindowKeyBindingsPasswordField.caretForegroundSplitPane.ancestorInputMapFormattedTextField.caretForegroundComboBox.ancestorInputMapInternalFrame.closeSoundFileChooser.newFolderIconToggleButton.borderRootPane.frameBorderInternalFrame.iconSlider.trackWidthListUIColorChooser.swatchesSwatchSizeToggleButton.textIconGapFormattedTextField.foregroundToggleButton.shadowTextArea.foregroundTree.lineTypeDashedMenu.fontTextPaneUIMenu.acceleratorFontButton.rolloverSeparator.shadowComboBox.fontOptionPane.errorDialog.border.backgroundCheckBoxMenuItem.selectionBackgroundPopupMenu.foregroundSplitPane.highlightCheckBox.rolloverComboBox.disabledForegroundOptionPane.borderRootPane.actionMapFileChooser.listViewIconToolBar.dockingBackgroundFileChooser.homeFolderIconSlider.focusGradientOptionPane.questionDialog.titlePane.foregroundCheckBoxMenuItem.foregroundScrollBar.widthRadioButton.textIconGapScrollBar.ancestorInputMap.RightToLeftInternalFrame.borderColorToolBar.highlightRadioButton.highlightList.fontSlider.horizontalThumbIconTextPane.selectionForegroundScrollBar.ancestorInputMapOptionPane.questionDialog.titlePane.shadowPanel.foregroundRadioButton.gradientTree.expandedIconSliderUIButton.focusInputMapTextPane.backgroundToolBar.ancestorInputMapList.selectionBackgroundFileView.directoryIconMenuItem.selectionBackgroundTree.closedIcon
</pre>
No están todas, que son muchas, muchas.
[[Categoría:Java:SWING]]

Menú de navegación