diff options
author | Roman Kennke <roman@kennke.org> | 2005-04-25 19:36:43 +0000 |
---|---|---|
committer | Michael Koch <mkoch@gcc.gnu.org> | 2005-04-25 19:36:43 +0000 |
commit | 8efae6bbfa04f662589bbfc64dbbe68935f973d2 (patch) | |
tree | 6a73f30784c260b998e5fb2e421b3c002d8ff608 /libjava/javax/swing/plaf | |
parent | 9f62c3e3ed53732a8fe755ad5109c1a6ed25bb0c (diff) | |
download | gcc-8efae6bbfa04f662589bbfc64dbbe68935f973d2.zip gcc-8efae6bbfa04f662589bbfc64dbbe68935f973d2.tar.gz gcc-8efae6bbfa04f662589bbfc64dbbe68935f973d2.tar.bz2 |
2005-04-25 Roman Kennke <roman@kennke.org>
* javax/swing/plaf/basic/BasicScrollBarUI.java
(initDefaults): Initialize thumb*Color fields correctly.
2005-04-25 Roman Kennke <roman@kennke.org>
* javax/swing/text/GapContent.java:
Added API comments.
2005-04-25 Roman Kennke <roman@kennke.org>
* javax/swing/plaf/metal/MetalBorders.java:
Added inner class ScrollPaneBorder.
* javax/swing/plaf/metal/MetalLookAndFeel.java
(initComponentDefaults): Added default for "ScrollPane.border"
to use the new ScrollPaneBorder.
2005-04-25 Roman Kennke <roman@kennke.org>
* javax/swing/text/AbstractDocument.java:
Added FIXME comments. This class still has to be
implemented thread-safe.
2005-04-25 Roman Kennke <roman@kennke.org>
* javax/swing/tree/DefaultTreeSelectionModel.java
(DefaultTreeSelectionModel): Initialize listenerList here.
2005-04-25 Roman Kennke <roman@kennke.org>
* javax/swing/plaf/metal/MetalTextFieldUI.java
(createUI): Return one instance per Component instead of a
shared instance.
2005-04-25 Roman Kennke <roman@kennke.org>
* javax/swing/text/Document.java:
Added API documentation comments.
2005-04-25 Roman Kennke <roman@kennke.org>
* javax/swing/text/AbstractDocument.java
(getDocumentProperties): Implemented.
(setDocumentProperties): Implemented.
(getProperty): Implemented.
(putProperty): Implemented.
2005-04-25 Roman Kennke <roman@kennke.org>
* javax/swing/BoxLayout
(preferredLayoutSize): Fixed computation so that it correctly
adds the top and bottom insets of the container.
2005-04-25 Roman Kennke <roman@kennke.org>
* javax/swing/plaf/basic/BasicMenuItemUI.java
(paintText): Make use of the 'selectionForeground' UI default
for text painting.
2005-04-25 Roman Kennke <roman@kennke.org>
* javax/swing/plaf/basic/BasicLookAndFeel.java
(initSystemColorDefaults): Modified colors to match the
BasicLookAndFeel in the reference implementation.
(initComponentDefaults): Likewise.
From-SVN: r98733
Diffstat (limited to 'libjava/javax/swing/plaf')
6 files changed, 336 insertions, 179 deletions
diff --git a/libjava/javax/swing/plaf/basic/BasicLookAndFeel.java b/libjava/javax/swing/plaf/basic/BasicLookAndFeel.java index 562f001..958ce27 100644 --- a/libjava/javax/swing/plaf/basic/BasicLookAndFeel.java +++ b/libjava/javax/swing/plaf/basic/BasicLookAndFeel.java @@ -159,34 +159,39 @@ public abstract class BasicLookAndFeel extends LookAndFeel */ protected void initSystemColorDefaults(UIDefaults defaults) { + Color highLight = new Color(249, 247, 246); + Color light = new Color(239, 235, 231); + Color shadow = new Color(139, 136, 134); + Color darkShadow = new Color(16, 16, 16); + Object[] uiDefaults; uiDefaults = new Object[] { "activeCaption", new ColorUIResource(0, 0, 128), "activeCaptionBorder", new ColorUIResource(Color.lightGray), "activeCaptionText", new ColorUIResource(Color.white), - "control", new ColorUIResource(Color.lightGray), - "controlDkShadow", new ColorUIResource(Color.black), - "controlHighlight", new ColorUIResource(Color.lightGray), - "controlLtHighlight", new ColorUIResource(Color.white), - "controlShadow", new ColorUIResource(Color.gray), - "controlText", new ColorUIResource(Color.black), + "control", new ColorUIResource(light), + "controlDkShadow", new ColorUIResource(shadow), + "controlHighlight", new ColorUIResource(highLight), + "controlLtHighlight", new ColorUIResource(highLight), + "controlShadow", new ColorUIResource(shadow), + "controlText", new ColorUIResource(darkShadow), "desktop", new ColorUIResource(0, 92, 92), "inactiveCaption", new ColorUIResource(Color.gray), "inactiveCaptionBorder", new ColorUIResource(Color.lightGray), "inactiveCaptionText", new ColorUIResource(Color.lightGray), - "info", new ColorUIResource(Color.white), - "infoText", new ColorUIResource(Color.black), - "menu", new ColorUIResource(Color.lightGray), - "menuText", new ColorUIResource(Color.black), - "scrollbar", new ColorUIResource(224, 224, 224), - "text", new ColorUIResource(Color.lightGray), - "textHighlight", new ColorUIResource(0, 0, 128), + "info", new ColorUIResource(light), + "infoText", new ColorUIResource(darkShadow), + "menu", new ColorUIResource(light), + "menuText", new ColorUIResource(darkShadow), + "scrollbar", new ColorUIResource(light), + "text", new ColorUIResource(Color.white), + "textHighlight", new ColorUIResource(Color.black), "textHighlightText", new ColorUIResource(Color.white), "textInactiveText", new ColorUIResource(Color.gray), "textText", new ColorUIResource(Color.black), - "window", new ColorUIResource(Color.white), + "window", new ColorUIResource(light), "windowBorder", new ColorUIResource(Color.black), - "windowText", new ColorUIResource(Color.black) + "windowText", new ColorUIResource(darkShadow) }; defaults.putDefaults(uiDefaults); } @@ -232,18 +237,16 @@ public abstract class BasicLookAndFeel extends LookAndFeel { Object[] uiDefaults; - // The default Look and Feel happens to use these three purple shades - // extensively. - Color lightPurple = new Color(0xCC, 0xCC, 0xFF); - Color midPurple = new Color(0x99, 0x99, 0xCC); - Color darkPurple = new Color(0x66, 0x66, 0x99); - + Color highLight = new Color(249, 247, 246); + Color light = new Color(239, 235, 231); + Color shadow = new Color(139, 136, 134); + Color darkShadow = new Color(16, 16, 16); + uiDefaults = new Object[] { "AbstractUndoableEdit.undoText", "Undo", "AbstractUndoableEdit.redoText", "Redo", - - "Button.background", new ColorUIResource(Color.lightGray), + "Button.background", new ColorUIResource(light), "Button.border", new UIDefaults.LazyValue() { @@ -252,55 +255,52 @@ public abstract class BasicLookAndFeel extends LookAndFeel return BasicBorders.getButtonBorder(); } }, - "Button.darkShadow", new ColorUIResource(Color.darkGray), + "Button.darkShadow", new ColorUIResource(shadow), "Button.focusInputMap", new UIDefaults.LazyInputMap(new Object[] { "SPACE", "pressed", "released SPACE", "released" }), - "Button.focus", midPurple, "Button.font", new FontUIResource("Dialog", Font.PLAIN, 12), - "Button.foreground", new ColorUIResource(Color.black), - "Button.highlight", new ColorUIResource(Color.white), - "Button.light", new ColorUIResource(Color.lightGray.brighter()), + "Button.foreground", new ColorUIResource(darkShadow), + "Button.highlight", new ColorUIResource(highLight), + "Button.light", new ColorUIResource(highLight), "Button.margin", new InsetsUIResource(2, 2, 2, 2), - "Button.shadow", new ColorUIResource(Color.gray), + "Button.shadow", new ColorUIResource(shadow), "Button.textIconGap", new Integer(4), "Button.textShiftOffset", new Integer(0), - "CheckBox.background", new ColorUIResource(Color.lightGray), + "CheckBox.background", new ColorUIResource(light), "CheckBox.border", new BorderUIResource.CompoundBorderUIResource(null, null), - "CheckBox.darkShadow", new ColorUIResource(Color.darkGray), "CheckBox.focusInputMap", new UIDefaults.LazyInputMap(new Object[] { "SPACE", "pressed", "released SPACE", "released" }), "CheckBox.font", new FontUIResource("Dialog", Font.PLAIN, 12), - "CheckBox.foreground", new ColorUIResource(Color.black), - "CheckBox.highlight", new ColorUIResource(Color.white), + "CheckBox.foreground", new ColorUIResource(darkShadow), "CheckBox.icon", BasicIconFactory.getCheckBoxIcon(), - "CheckBox.light", new ColorUIResource(Color.lightGray.brighter()), "CheckBox.margin",new InsetsUIResource(2, 2, 2, 2), - "CheckBox.shadow", new ColorUIResource(Color.gray), "CheckBox.textIconGap", new Integer(4), "CheckBox.textShiftOffset", new Integer(0), "CheckBoxMenuItem.acceleratorFont", new FontUIResource("Dialog", Font.PLAIN, 12), - "CheckBoxMenuItem.acceleratorForeground", new ColorUIResource(Color.black), - "CheckBoxMenuItem.acceleratorSelectionForeground", new ColorUIResource(Color.white), + "CheckBoxMenuItem.acceleratorForeground", + new ColorUIResource(darkShadow), + "CheckBoxMenuItem.acceleratorSelectionForeground", + new ColorUIResource(Color.white), "CheckBoxMenuItem.arrowIcon", BasicIconFactory.getMenuItemArrowIcon(), - "CheckBoxMenuItem.background", new ColorUIResource(Color.lightGray), + "CheckBoxMenuItem.background", new ColorUIResource(light), "CheckBoxMenuItem.border", new BasicBorders.MarginBorder(), "CheckBoxMenuItem.borderPainted", Boolean.FALSE, "CheckBoxMenuItem.checkIcon", BasicIconFactory.getCheckBoxMenuItemIcon(), "CheckBoxMenuItem.font", new FontUIResource("Dialog", Font.PLAIN, 12), - "CheckBoxMenuItem.foreground", new ColorUIResource(Color.black), + "CheckBoxMenuItem.foreground", new ColorUIResource(darkShadow), "CheckBoxMenuItem.margin", new InsetsUIResource(2, 2, 2, 2), - "CheckBoxMenuItem.selectionBackground", new ColorUIResource(lightPurple), - "CheckBoxMenuItem.selectionForeground", new ColorUIResource(Color.black), - "ColorChooser.background", new ColorUIResource(Color.lightGray), + "CheckBoxMenuItem.selectionBackground", new ColorUIResource(Color.black), + "CheckBoxMenuItem.selectionForeground", new ColorUIResource(Color.white), + "ColorChooser.background", new ColorUIResource(light), "ColorChooser.cancelText", "Cancel", "ColorChooser.font", new FontUIResource("Dialog", Font.PLAIN, 12), - "ColorChooser.foreground", new ColorUIResource(Color.black), + "ColorChooser.foreground", new ColorUIResource(darkShadow), "ColorChooser.hsbBlueText", "B", "ColorChooser.hsbBrightnessText", "B", "ColorChooser.hsbGreenText", "G", @@ -319,7 +319,7 @@ public abstract class BasicLookAndFeel extends LookAndFeel "ColorChooser.rgbRedMnemonic", new Integer(82), "ColorChooser.rgbRedText", "Red", "ColorChooser.sampleText", "Sample Text Sample Text", - "ColorChooser.swatchesDefaultRecentColor", new ColorUIResource(Color.lightGray), + "ColorChooser.swatchesDefaultRecentColor", new ColorUIResource(light), "ColorChooser.swatchesNameText", "Swatches", "ColorChooser.swatchesRecentSwatchSize", new Dimension(10, 10), "ColorChooser.swatchesRecentText", "Recent:", @@ -331,13 +331,17 @@ public abstract class BasicLookAndFeel extends LookAndFeel "HOME", "homePassThrough", "END", "endPassThrough" }), - "ComboBox.background", new ColorUIResource(Color.white), - "ComboBox.disabledBackground", new ColorUIResource(Color.lightGray), + "ComboBox.background", new ColorUIResource(light), + "ComboBox.buttonBackground", new ColorUIResource(light), + "ComboBox.buttonDarkShadow", new ColorUIResource(shadow), + "ComboBox.buttonHighlight", new ColorUIResource(highLight), + "ComboBox.buttonShadow", new ColorUIResource(shadow), + "ComboBox.disabledBackground", new ColorUIResource(light), "ComboBox.disabledForeground", new ColorUIResource(Color.gray), "ComboBox.font", new FontUIResource("SansSerif", Font.PLAIN, 12), "ComboBox.foreground", new ColorUIResource(Color.black), - "ComboBox.selectionBackground", new ColorUIResource(lightPurple), - "ComboBox.selectionForeground", new ColorUIResource(Color.black), + "ComboBox.selectionBackground", new ColorUIResource(Color.black), + "ComboBox.selectionForeground", new ColorUIResource(Color.white), "Desktop.ancestorInputMap", new UIDefaults.LazyInputMap(new Object[] { "KP_LEFT", "left", "KP_RIGHT", "right", @@ -359,13 +363,13 @@ public abstract class BasicLookAndFeel extends LookAndFeel "ctrl F10", "maximize", "ctrl alt shift F6","selectPreviousFrame" }), - "Desktop.background", new ColorUIResource(175, 163, 236), + "Desktop.background", new ColorUIResource(0, 92, 92), "DesktopIcon.border", new BorderUIResource.CompoundBorderUIResource(null, null), "EditorPane.background", new ColorUIResource(Color.white), "EditorPane.border", new BasicBorders.MarginBorder(), "EditorPane.caretBlinkRate", new Integer(500), - "EditorPane.caretForeground", new ColorUIResource(Color.red), + "EditorPane.caretForeground", new ColorUIResource(Color.black), "EditorPane.font", new FontUIResource("Serif", Font.PLAIN, 12), "EditorPane.foreground", new ColorUIResource(Color.black), "EditorPane.inactiveForeground", new ColorUIResource(Color.gray), @@ -384,7 +388,7 @@ public abstract class BasicLookAndFeel extends LookAndFeel 0), "insert-tab") }, "EditorPane.margin", new InsetsUIResource(3, 3, 3, 3), - "EditorPane.selectionBackground", new ColorUIResource(Color.lightGray), + "EditorPane.selectionBackground", new ColorUIResource(Color.black), "EditorPane.selectionForeground", new ColorUIResource(Color.white), "FileChooser.acceptAllFileFilterText", "All Files (*.*)", "FileChooser.ancestorInputMap", new UIDefaults.LazyInputMap(new Object[] { @@ -430,18 +434,33 @@ public abstract class BasicLookAndFeel extends LookAndFeel // XXX Don't use gif "FileView.hardDriveIcon", new IconUIResource(new ImageIcon("icons/HardDrive.gif")), "FocusManagerClassName", "TODO", + "FormattedTextField.background", new ColorUIResource(light), + "FormattedTextField.caretForeground", new ColorUIResource(Color.black), + "FormattedTextField.foreground", new ColorUIResource(Color.black), + "FormattedTextField.inactiveBackground", new ColorUIResource(light), + "FormattedTextField.inactiveForeground", new ColorUIResource(Color.gray), + "FormattedTextField.selectionBackground", + new ColorUIResource(Color.black), + "FormattedTextField.selectionForeground", + new ColorUIResource(Color.white), "FormView.resetButtonText", "Reset", "FormView.submitButtonText", "Submit Query", - "InternalFrame.activeTitleBackground", new ColorUIResource(162, 167, 241), - "InternalFrame.activeTitleForeground", new ColorUIResource(Color.black), - "InternalFrame.border", new BorderUIResource.CompoundBorderUIResource(null, - null), + "InternalFrame.activeTitleBackground", new ColorUIResource(0, 0, 128), + "InternalFrame.activeTitleForeground", new ColorUIResource(Color.white), + "InternalFrame.border", + new BorderUIResource.CompoundBorderUIResource(null, null), + "InternalFrame.borderColor", new ColorUIResource(light), + "InternalFrame.borderDarkShadow", new ColorUIResource(shadow), + "InternalFrame.borderHighlight", new ColorUIResource(highLight), + "InternalFrame.borderLight", new ColorUIResource(light), + "InternalFrame.borderShadow", new ColorUIResource(shadow), "InternalFrame.closeIcon", BasicIconFactory.createEmptyFrameIcon(), // XXX Don't use gif "InternalFrame.icon", new IconUIResource(new ImageIcon("icons/JavaCup.gif")), "InternalFrame.iconifyIcon", BasicIconFactory.createEmptyFrameIcon(), - "InternalFrame.inactiveTitleBackground", new ColorUIResource(Color.lightGray), - "InternalFrame.inactiveTitleForeground", new ColorUIResource(Color.black), + "InternalFrame.inactiveTitleBackground", new ColorUIResource(Color.gray), + "InternalFrame.inactiveTitleForeground", + new ColorUIResource(Color.lightGray), "InternalFrame.maximizeIcon", BasicIconFactory.createEmptyFrameIcon(), "InternalFrame.minimizeIcon", BasicIconFactory.createEmptyFrameIcon(), "InternalFrame.titleFont", new FontUIResource("Dialog", Font.PLAIN, 12), @@ -450,12 +469,12 @@ public abstract class BasicLookAndFeel extends LookAndFeel "ctrl SPACE", "showSystemMenu", "ESCAPE", "showSystemMenu" }, - "Label.background", new ColorUIResource(Color.lightGray), + "Label.background", new ColorUIResource(light), "Label.disabledForeground", new ColorUIResource(Color.white), - "Label.disabledShadow", new ColorUIResource(Color.gray), + "Label.disabledShadow", new ColorUIResource(shadow), "Label.font", new FontUIResource("Dialog", Font.PLAIN, 12), - "Label.foreground", new ColorUIResource(Color.black), - "List.background", new ColorUIResource(Color.white), + "Label.foreground", new ColorUIResource(darkShadow), + "List.background", new ColorUIResource(light), "List.border", new BasicBorders.MarginBorder(), "List.focusInputMap", new UIDefaults.LazyInputMap(new Object[] { "PAGE_UP", "scrollUp", @@ -477,20 +496,20 @@ public abstract class BasicLookAndFeel extends LookAndFeel "shift PAGE_UP","scrollUpExtendSelection", "KP_DOWN", "selectNextRow" }), - "List.foreground", new ColorUIResource(Color.black), - "List.selectionBackground", new ColorUIResource(0xCC, 0xCC, 0xFF), - "List.selectionForeground", new ColorUIResource(Color.black), + "List.foreground", new ColorUIResource(darkShadow), + "List.selectionBackground", new ColorUIResource(Color.black), + "List.selectionForeground", new ColorUIResource(Color.white), "Menu.acceleratorFont", new FontUIResource("Dialog", Font.PLAIN, 12), - "Menu.acceleratorForeground", new ColorUIResource(Color.black), + "Menu.acceleratorForeground", new ColorUIResource(darkShadow), "Menu.acceleratorSelectionForeground", new ColorUIResource(Color.white), "Menu.arrowIcon", BasicIconFactory.getMenuArrowIcon(), - "Menu.background", new ColorUIResource(Color.lightGray), + "Menu.background", new ColorUIResource(light), "Menu.border", new BasicBorders.MarginBorder(), "Menu.borderPainted", Boolean.FALSE, "Menu.checkIcon", BasicIconFactory.getMenuItemCheckIcon(), "Menu.consumesTabs", Boolean.TRUE, "Menu.font", new FontUIResource("Dialog", Font.PLAIN, 12), - "Menu.foreground", new ColorUIResource(Color.black), + "Menu.foreground", new ColorUIResource(darkShadow), "Menu.margin", new InsetsUIResource(2, 2, 2, 2), "Menu.selectedWindowInputMapBindings", new Object[] { "ESCAPE", "cancel", @@ -505,115 +524,130 @@ public abstract class BasicLookAndFeel extends LookAndFeel "ENTER", "return", "SPACE", "return" }, - "Menu.selectionBackground", new ColorUIResource(lightPurple), - "Menu.selectionForeground", new ColorUIResource(Color.black), - "MenuBar.background", new ColorUIResource(Color.lightGray), + "Menu.selectionBackground", new ColorUIResource(Color.black), + "Menu.selectionForeground", new ColorUIResource(Color.white), + "MenuBar.background", new ColorUIResource(light), "MenuBar.border", new BasicBorders.MenuBarBorder(null, null), "MenuBar.font", new FontUIResource("Dialog", Font.PLAIN, 12), - "MenuBar.foreground", new ColorUIResource(Color.black), + "MenuBar.foreground", new ColorUIResource(darkShadow), + "MenuBar.highlight", new ColorUIResource(highLight), + "MenuBar.shadow", new ColorUIResource(shadow), "MenuBar.windowBindings", new Object[] { "F10", "takeFocus" }, "MenuItem.acceleratorDelimiter", "-", "MenuItem.acceleratorFont", new FontUIResource("Dialog", Font.PLAIN, 12), - "MenuItem.acceleratorForeground", new ColorUIResource(Color.black), - "MenuItem.acceleratorSelectionForeground", new ColorUIResource(Color.white), + "MenuItem.acceleratorForeground", new ColorUIResource(darkShadow), + "MenuItem.acceleratorSelectionForeground", + new ColorUIResource(Color.white), "MenuItem.arrowIcon", BasicIconFactory.getMenuItemArrowIcon(), - "MenuItem.background", new ColorUIResource(Color.lightGray), + "MenuItem.background", new ColorUIResource(light), "MenuItem.border", new BasicBorders.MarginBorder(), "MenuItem.borderPainted", Boolean.FALSE, "MenuItem.checkIcon", BasicIconFactory.getMenuItemCheckIcon(), "MenuItem.font", new FontUIResource("Dialog", Font.PLAIN, 12), - "MenuItem.foreground", new ColorUIResource(Color.black), + "MenuItem.foreground", new ColorUIResource(darkShadow), "MenuItem.margin", new InsetsUIResource(2, 2, 2, 2), - "MenuItem.selectionBackground", new ColorUIResource(lightPurple), - "MenuItem.selectionForeground", new ColorUIResource(Color.black), - "OptionPane.background", new ColorUIResource(Color.lightGray), - "OptionPane.border", new BorderUIResource.EmptyBorderUIResource(0, 0, 0, 0), - "OptionPane.buttonAreaBorder", new BorderUIResource.EmptyBorderUIResource(0, 0, 0, 0), + "MenuItem.selectionBackground", new ColorUIResource(Color.black), + "MenuItem.selectionForeground", new ColorUIResource(Color.white), + "OptionPane.background", new ColorUIResource(light), + "OptionPane.border", + new BorderUIResource.EmptyBorderUIResource(0, 0, 0, 0), + "OptionPane.buttonAreaBorder", + new BorderUIResource.EmptyBorderUIResource(0, 0, 0, 0), "OptionPane.cancelButtonText", "Cancel", // XXX Don't use gif - "OptionPane.errorIcon", new IconUIResource(new ImageIcon("icons/Error.gif")), + "OptionPane.errorIcon", + new IconUIResource(new ImageIcon("icons/Error.gif")), "OptionPane.font", new FontUIResource("Dialog", Font.PLAIN, 12), - "OptionPane.foreground", new ColorUIResource(Color.black), + "OptionPane.foreground", new ColorUIResource(darkShadow), // XXX Don't use gif - "OptionPane.informationIcon", new IconUIResource(new ImageIcon("icons/Inform.gif")), - "OptionPane.messageAreaBorder", new BorderUIResource.EmptyBorderUIResource(0, 0, 0, 0), - "OptionPane.messageForeground", new ColorUIResource(Color.black), + "OptionPane.informationIcon", + new IconUIResource(new ImageIcon("icons/Inform.gif")), + "OptionPane.messageAreaBorder", + new BorderUIResource.EmptyBorderUIResource(0, 0, 0, 0), + "OptionPane.messageForeground", new ColorUIResource(darkShadow), "OptionPane.minimumSize", new DimensionUIResource(262, 90), "OptionPane.noButtonText", "No", "OptionPane.okButtonText", "OK", // XXX Don't use gif - "OptionPane.questionIcon", new IconUIResource(new ImageIcon("icons/Question.gif")), + "OptionPane.questionIcon", + new IconUIResource(new ImageIcon("icons/Question.gif")), // XXX Don't use gif - "OptionPane.warningIcon", new IconUIResource(new ImageIcon("icons/Warn.gif")), + "OptionPane.warningIcon", + new IconUIResource(new ImageIcon("icons/Warn.gif")), "OptionPane.windowBindings", new Object[] { "ESCAPE", "close" }, "OptionPane.yesButtonText", "Yes", - "Panel.background", new ColorUIResource(Color.lightGray), + "Panel.background", new ColorUIResource(light), "Panel.font", new FontUIResource("Dialog", Font.PLAIN, 12), "Panel.foreground", new ColorUIResource(Color.black), - "PasswordField.background", new ColorUIResource(Color.white), + "PasswordField.background", new ColorUIResource(light), "PasswordField.border", new BasicBorders.FieldBorder(null, null, null, null), "PasswordField.caretBlinkRate", new Integer(500), "PasswordField.caretForeground", new ColorUIResource(Color.black), "PasswordField.font", new FontUIResource("MonoSpaced", Font.PLAIN, 12), "PasswordField.foreground", new ColorUIResource(Color.black), + "PasswordField.inactiveBackground", new ColorUIResource(light), "PasswordField.inactiveForeground", new ColorUIResource(Color.gray), "PasswordField.keyBindings", new JTextComponent.KeyBinding[] { new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "notify-field-accept")}, "PasswordField.margin", new InsetsUIResource(0, 0, 0, 0), - "PasswordField.selectionBackground", new ColorUIResource(lightPurple), - "PasswordField.selectionForeground", new ColorUIResource(Color.black), - "PopupMenu.background", new ColorUIResource(Color.lightGray), + "PasswordField.selectionBackground", new ColorUIResource(Color.black), + "PasswordField.selectionForeground", new ColorUIResource(Color.white), + "PopupMenu.background", new ColorUIResource(light), "PopupMenu.border", new BorderUIResource.BevelBorderUIResource(0), "PopupMenu.font", new FontUIResource("Dialog", Font.PLAIN, 12), - "PopupMenu.foreground", new ColorUIResource(Color.black), - "ProgressBar.background", new ColorUIResource(Color.lightGray), + "PopupMenu.foreground", new ColorUIResource(darkShadow), + "ProgressBar.background", new ColorUIResource(light), "ProgressBar.border", new BorderUIResource.LineBorderUIResource(Color.darkGray), "ProgressBar.cellLength", new Integer(1), "ProgressBar.cellSpacing", new Integer(0), "ProgressBar.font", new FontUIResource("Dialog", Font.PLAIN, 12), - "ProgressBar.foreground", new ColorUIResource(midPurple), - "ProgressBar.selectionBackground", new ColorUIResource(lightPurple), - "ProgressBar.selectionForeground", new ColorUIResource(Color.lightGray), + "ProgressBar.foreground", new ColorUIResource(Color.black), + "ProgressBar.selectionBackground", new ColorUIResource(Color.black), + "ProgressBar.selectionForeground", new ColorUIResource(light), "ProgressBar.repaintInterval", new Integer(250), "ProgressBar.cycleTime", new Integer(6000), - "RadioButton.background", new ColorUIResource(Color.lightGray), + "RadioButton.background", new ColorUIResource(light), "RadioButton.border", new BorderUIResource.CompoundBorderUIResource(null, null), - "RadioButton.darkShadow", new ColorUIResource(Color.darkGray), + "RadioButton.darkShadow", new ColorUIResource(shadow), "RadioButton.focusInputMap", new UIDefaults.LazyInputMap(new Object[] { "SPACE", "pressed", "released SPACE", "released" }), "RadioButton.font", new FontUIResource("Dialog", Font.PLAIN, 12), - "RadioButton.foreground", new ColorUIResource(Color.black), - "RadioButton.highlight", new ColorUIResource(Color.white), + "RadioButton.foreground", new ColorUIResource(darkShadow), + "RadioButton.highlight", new ColorUIResource(highLight), "RadioButton.icon", BasicIconFactory.getRadioButtonIcon(), - "RadioButton.light", new ColorUIResource(Color.lightGray.brighter()), + "RadioButton.light", new ColorUIResource(highLight), "RadioButton.margin", new InsetsUIResource(2, 2, 2, 2), - "RadioButton.shadow", new ColorUIResource(Color.gray), + "RadioButton.shadow", new ColorUIResource(shadow), "RadioButton.textIconGap", new Integer(4), "RadioButton.textShiftOffset", new Integer(0), - "RadioButtonMenuItem.acceleratorFont", new FontUIResource("Dialog", - Font.PLAIN, 12), - "RadioButtonMenuItem.acceleratorForeground", new ColorUIResource(Color.black), - "RadioButtonMenuItem.acceleratorSelectionForeground", new ColorUIResource(Color.white), + "RadioButtonMenuItem.acceleratorFont", + new FontUIResource("Dialog", Font.PLAIN, 12), + "RadioButtonMenuItem.acceleratorForeground", + new ColorUIResource(darkShadow), + "RadioButtonMenuItem.acceleratorSelectionForeground", + new ColorUIResource(Color.white), "RadioButtonMenuItem.arrowIcon", BasicIconFactory.getMenuItemArrowIcon(), - "RadioButtonMenuItem.background", new ColorUIResource(Color.lightGray), + "RadioButtonMenuItem.background", new ColorUIResource(light), "RadioButtonMenuItem.border", new BasicBorders.MarginBorder(), "RadioButtonMenuItem.borderPainted", Boolean.FALSE, "RadioButtonMenuItem.checkIcon", BasicIconFactory.getRadioButtonMenuItemIcon(), "RadioButtonMenuItem.font", new FontUIResource("Dialog", Font.PLAIN, 12), - "RadioButtonMenuItem.foreground", new ColorUIResource(Color.black), + "RadioButtonMenuItem.foreground", new ColorUIResource(darkShadow), "RadioButtonMenuItem.margin", new InsetsUIResource(2, 2, 2, 2), - "RadioButtonMenuItem.selectionBackground", new ColorUIResource(lightPurple), - "RadioButtonMenuItem.selectionForeground", new ColorUIResource(Color.black), + "RadioButtonMenuItem.selectionBackground", + new ColorUIResource(Color.black), + "RadioButtonMenuItem.selectionForeground", + new ColorUIResource(Color.white), "RootPane.defaultButtonWindowKeyBindings", new Object[] { "ENTER", "press", "released ENTER", "release", @@ -635,15 +669,15 @@ public abstract class BasicLookAndFeel extends LookAndFeel "DOWN", "positiveUnitIncrement", "KP_RIGHT", "negativeUnitIncrement" }), - "ScrollBar.foreground", new ColorUIResource(Color.lightGray), + "ScrollBar.foreground", new ColorUIResource(light), "ScrollBar.maximumThumbSize", new DimensionUIResource(4096, 4096), "ScrollBar.minimumThumbSize", new DimensionUIResource(8, 8), - "ScrollBar.thumb", new ColorUIResource(Color.lightGray), - "ScrollBar.thumbDarkShadow", new ColorUIResource(Color.black), - "ScrollBar.thumbHighlight", new ColorUIResource(Color.white), - "ScrollBar.thumbLightShadow", new ColorUIResource(Color.gray), - "ScrollBar.track", new ColorUIResource(224, 224, 224), - "ScrollBar.trackHighlight", new ColorUIResource(Color.black), + "ScrollBar.thumb", new ColorUIResource(light), + "ScrollBar.thumbDarkShadow", new ColorUIResource(shadow), + "ScrollBar.thumbHighlight", new ColorUIResource(highLight), + "ScrollBar.thumbShadow", new ColorUIResource(shadow), + "ScrollBar.track", new ColorUIResource(light), + "ScrollBar.trackHighlight", new ColorUIResource(shadow), "ScrollPane.ancestorInputMap", new UIDefaults.LazyInputMap(new Object[] { "PAGE_UP", "scrollUp", "KP_LEFT", "unitScrollLeft", @@ -660,16 +694,16 @@ public abstract class BasicLookAndFeel extends LookAndFeel "KP_UP", "unitScrollUp", "KP_DOWN", "unitScrollDown" }), - "ScrollPane.background", new ColorUIResource(Color.lightGray), + "ScrollPane.background", new ColorUIResource(light), "ScrollPane.border", new BorderUIResource.EtchedBorderUIResource(), "ScrollPane.font", new FontUIResource("Dialog", Font.PLAIN, 12), - "ScrollPane.foreground", new ColorUIResource(Color.black), - "Separator.background", new ColorUIResource(Color.white), - "Separator.foreground", new ColorUIResource(Color.gray), - "Separator.highlight", new ColorUIResource(Color.white), - "Separator.shadow", new ColorUIResource(Color.gray), - "Slider.background", new ColorUIResource(Color.lightGray), - "Slider.focus", new ColorUIResource(Color.black), + "ScrollPane.foreground", new ColorUIResource(darkShadow), + "Separator.background", new ColorUIResource(highLight), + "Separator.foreground", new ColorUIResource(shadow), + "Separator.highlight", new ColorUIResource(highLight), + "Separator.shadow", new ColorUIResource(shadow), + "Slider.background", new ColorUIResource(light), + "Slider.focus", new ColorUIResource(shadow), "Slider.focusInputMap", new UIDefaults.LazyInputMap(new Object[] { "PAGE_UP", "positiveBlockIncrement", "PAGE_DOWN", "negativeBlockIncrement", @@ -685,12 +719,14 @@ public abstract class BasicLookAndFeel extends LookAndFeel "KP_RIGHT", "positiveUnitIncrement" }), "Slider.focusInsets", new InsetsUIResource(2, 2, 2, 2), - "Slider.foreground", new ColorUIResource(Color.lightGray), - "Slider.highlight", new ColorUIResource(Color.white), - "Slider.shadow", new ColorUIResource(Color.gray), + "Slider.foreground", new ColorUIResource(light), + "Slider.highlight", new ColorUIResource(highLight), + "Slider.shadow", new ColorUIResource(shadow), "Slider.thumbHeight", new Integer(20), "Slider.thumbWidth", new Integer(10), "Slider.tickHeight", new Integer(12), + "Spinner.background", new ColorUIResource(light), + "Spinner.foreground", new ColorUIResource(light), "SplitPane.ancestorInputMap", new UIDefaults.LazyInputMap(new Object[] { "F6", "toggleFocus", "F8", "startResize", @@ -705,21 +741,22 @@ public abstract class BasicLookAndFeel extends LookAndFeel "DOWN", "positiveIncrement", "KP_RIGHT", "positiveIncrement" }), - "SplitPane.background", new ColorUIResource(Color.lightGray), + "SplitPane.background", new ColorUIResource(light), "SplitPane.border", new BasicBorders.SplitPaneBorder(null, null), + "SplitPane.darkShadow", new ColorUIResource(shadow), "SplitPane.dividerSize", new Integer(10), - "SplitPane.highlight", new ColorUIResource(Color.white), - "SplitPane.shadow", new ColorUIResource(Color.gray), + "SplitPane.highlight", new ColorUIResource(highLight), + "SplitPane.shadow", new ColorUIResource(shadow), "TabbedPane.ancestorInputMap", new UIDefaults.LazyInputMap(new Object[] { "ctrl PAGE_DOWN","navigatePageDown", "ctrl PAGE_UP", "navigatePageUp", "ctrl UP", "requestFocus", "ctrl KP_UP", "requestFocus" }), - "TabbedPane.background", new ColorUIResource(Color.LIGHT_GRAY), + "TabbedPane.background", new ColorUIResource(light), "TabbedPane.contentBorderInsets", new InsetsUIResource(2, 2, 3, 3), - "TabbedPane.darkShadow", new ColorUIResource(Color.darkGray), - "TabbedPane.focus", new ColorUIResource(Color.black), + "TabbedPane.darkShadow", new ColorUIResource(shadow), + "TabbedPane.focus", new ColorUIResource(darkShadow), "TabbedPane.focusInputMap", new UIDefaults.LazyInputMap(new Object[] { "LEFT", "navigateLeft", "KP_UP", "navigateUp", @@ -733,11 +770,11 @@ public abstract class BasicLookAndFeel extends LookAndFeel "DOWN", "navigateDown" }), "TabbedPane.font", new FontUIResource("Dialog", Font.PLAIN, 12), - "TabbedPane.foreground", new ColorUIResource(Color.black), - "TabbedPane.highlight", new ColorUIResource(Color.lightGray), - "TabbedPane.lightHighlight", new ColorUIResource(Color.white), + "TabbedPane.foreground", new ColorUIResource(darkShadow), + "TabbedPane.highlight", new ColorUIResource(highLight), + "TabbedPane.light", new ColorUIResource(highLight), "TabbedPane.selectedTabPadInsets", new InsetsUIResource(2, 2, 2, 1), - "TabbedPane.shadow", new ColorUIResource(Color.gray), + "TabbedPane.shadow", new ColorUIResource(shadow), "TabbedPane.tabbedPaneTabAreaInsets", new InsetsUIResource(3, 2, 1, 2), "TabbedPane.tabbedPaneTabInsets", new InsetsUIResource(1, 4, 1, 4), "TabbedPane.tabbedPaneContentBorderInsets", new InsetsUIResource(3, 2, 1, 2), @@ -784,21 +821,22 @@ public abstract class BasicLookAndFeel extends LookAndFeel "ctrl PAGE_DOWN", "scrollRightChangeSelection", "PAGE_UP", "scrollUpChangeSelection" }), - "Table.background", new ColorUIResource(Color.white), - "Table.focusCellBackground", new ColorUIResource(Color.white), - "Table.focusCellForeground", new ColorUIResource(Color.black), - "Table.focusCellHighlightBorder", new BorderUIResource.LineBorderUIResource(Color.white), + "Table.background", new ColorUIResource(light), + "Table.focusCellBackground", new ColorUIResource(light), + "Table.focusCellForeground", new ColorUIResource(darkShadow), + "Table.focusCellHighlightBorder", + new BorderUIResource.LineBorderUIResource(Color.white), "Table.font", new FontUIResource("Dialog", Font.PLAIN, 12), - "Table.foreground", new ColorUIResource(Color.black), + "Table.foreground", new ColorUIResource(darkShadow), "Table.gridColor", new ColorUIResource(Color.gray), "Table.scrollPaneBorder", new BorderUIResource.BevelBorderUIResource(0), - "Table.selectionBackground", new ColorUIResource(lightPurple), - "Table.selectionForeground", new ColorUIResource(Color.black), - "TableHeader.background", new ColorUIResource(Color.lightGray), + "Table.selectionBackground", new ColorUIResource(Color.black), + "Table.selectionForeground", new ColorUIResource(Color.white), + "TableHeader.background", new ColorUIResource(light), "TableHeader.cellBorder", new BorderUIResource.BevelBorderUIResource(0), "TableHeader.font", new FontUIResource("Dialog", Font.PLAIN, 12), - "TableHeader.foreground", new ColorUIResource(Color.black), - "TextArea.background", new ColorUIResource(Color.white), + "TableHeader.foreground", new ColorUIResource(darkShadow), + "TextArea.background", new ColorUIResource(light), "TextArea.border", new BasicBorders.MarginBorder(), "TextArea.caretBlinkRate", new Integer(500), "TextArea.caretForeground", new ColorUIResource(Color.black), @@ -820,15 +858,20 @@ public abstract class BasicLookAndFeel extends LookAndFeel 0), "insert-tab") }, "TextArea.margin", new InsetsUIResource(0, 0, 0, 0), - "TextArea.selectionBackground", new ColorUIResource(lightPurple), - "TextArea.selectionForeground", new ColorUIResource(Color.black), - "TextField.background", new ColorUIResource(Color.white), + "TextArea.selectionBackground", new ColorUIResource(Color.black), + "TextArea.selectionForeground", new ColorUIResource(Color.white), + "TextField.background", new ColorUIResource(light), "TextField.border", new BasicBorders.FieldBorder(null, null, null, null), "TextField.caretBlinkRate", new Integer(500), "TextField.caretForeground", new ColorUIResource(Color.black), + "TextField.darkShadow", new ColorUIResource(shadow), "TextField.font", new FontUIResource("SansSerif", Font.PLAIN, 12), "TextField.foreground", new ColorUIResource(Color.black), + "TextField.highlight", new ColorUIResource(highLight), + "TextField.inactiveBackground", new ColorUIResource(light), "TextField.inactiveForeground", new ColorUIResource(Color.gray), + "TextField.light", new ColorUIResource(highLight), + "TextField.highlight", new ColorUIResource(light), "TextField.keyBindings", new JTextComponent.KeyBinding[] { new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), @@ -841,8 +884,8 @@ public abstract class BasicLookAndFeel extends LookAndFeel "selection-forward"), }, "TextField.margin", new InsetsUIResource(0, 0, 0, 0), - "TextField.selectionBackground", new ColorUIResource(lightPurple), - "TextField.selectionForeground", new ColorUIResource(Color.black), + "TextField.selectionBackground", new ColorUIResource(Color.black), + "TextField.selectionForeground", new ColorUIResource(Color.white), "TextPane.background", new ColorUIResource(Color.white), "TextPane.border", new BasicBorders.MarginBorder(), "TextPane.caretBlinkRate", new Integer(500), @@ -865,20 +908,25 @@ public abstract class BasicLookAndFeel extends LookAndFeel 0), "insert-tab") }, "TextPane.margin", new InsetsUIResource(3, 3, 3, 3), - "TextPane.selectionBackground", new ColorUIResource(Color.lightGray), + "TextPane.selectionBackground", new ColorUIResource(Color.black), "TextPane.selectionForeground", new ColorUIResource(Color.white), "TitledBorder.border", new BorderUIResource.EtchedBorderUIResource(), "TitledBorder.font", new FontUIResource("Dialog", Font.PLAIN, 12), - "TitledBorder.titleColor", new ColorUIResource(Color.black), - "ToggleButton.background", new ColorUIResource(Color.lightGray), - "ToggleButton.border", new BorderUIResource.CompoundBorderUIResource(null, null), + "TitledBorder.titleColor", new ColorUIResource(darkShadow), + "ToggleButton.background", new ColorUIResource(light), + "ToggleButton.border", + new BorderUIResource.CompoundBorderUIResource(null, null), + "ToggleButton.darkShadow", new ColorUIResource(shadow), "ToggleButton.focusInputMap", new UIDefaults.LazyInputMap(new Object[] { "SPACE", "pressed", "released SPACE", "released" }), "ToggleButton.font", new FontUIResource("Dialog", Font.PLAIN, 12), - "ToggleButton.foreground", new ColorUIResource(Color.black), + "ToggleButton.foreground", new ColorUIResource(darkShadow), + "ToggleButton.highlight", new ColorUIResource(highLight), + "ToggleButton.light", new ColorUIResource(light), "ToggleButton.margin", new InsetsUIResource(2, 14, 2, 14), + "ToggleButton.shadow", new ColorUIResource(shadow), "ToggleButton.textIconGap", new Integer(4), "ToggleButton.textShiftOffset", new Integer(0), "ToolBar.ancestorInputMap", new UIDefaults.LazyInputMap(new Object[] { @@ -891,23 +939,27 @@ public abstract class BasicLookAndFeel extends LookAndFeel "RIGHT", "navigateRight", "KP_RIGHT", "navigateRight" }), - "ToolBar.background", new ColorUIResource(Color.lightGray), + "ToolBar.background", new ColorUIResource(light), "ToolBar.border", new BorderUIResource.EtchedBorderUIResource(), - "ToolBar.dockingBackground", new ColorUIResource(Color.lightGray), - "ToolBar.dockingForeground", new ColorUIResource(11, 30, 143), - "ToolBar.floatingBackground", new ColorUIResource(Color.lightGray), - "ToolBar.floatingForeground", new ColorUIResource(113, 171, 212), + "ToolBar.darkShadow", new ColorUIResource(shadow), + "ToolBar.dockingBackground", new ColorUIResource(light), + "ToolBar.dockingForeground", new ColorUIResource(Color.red), + "ToolBar.floatingBackground", new ColorUIResource(light), + "ToolBar.floatingForeground", new ColorUIResource(Color.darkGray), "ToolBar.font", new FontUIResource("Dialog", Font.PLAIN, 12), - "ToolBar.foreground", new ColorUIResource(Color.black), + "ToolBar.foreground", new ColorUIResource(darkShadow), + "ToolBar.highlight", new ColorUIResource(highLight), + "ToolBar.light", new ColorUIResource(highLight), "ToolBar.separatorSize", new DimensionUIResource(20, 20), - "ToolTip.background", new ColorUIResource(122, 178, 241), + "ToolBar.shadow", new ColorUIResource(shadow), + "ToolTip.background", new ColorUIResource(light), "ToolTip.border", new BorderUIResource.LineBorderUIResource(Color.lightGray), "ToolTip.font", new FontUIResource("SansSerif", Font.PLAIN, 12), - "ToolTip.foreground", new ColorUIResource(Color.black), + "ToolTip.foreground", new ColorUIResource(darkShadow), "Tree.ancestorInputMap", new UIDefaults.LazyInputMap(new Object[] { "ESCAPE", "cancel" }), - "Tree.background", new ColorUIResource(Color.white), + "Tree.background", new ColorUIResource(light), "Tree.changeSelectionWithFocus", Boolean.TRUE, "Tree.closedIcon", new IconUIResource(new ImageIcon("icons/TreeClosed.png")), "Tree.collapsedIcon", new IconUIResource(new ImageIcon("icons/TreeCollapsed.png")), @@ -967,13 +1019,14 @@ public abstract class BasicLookAndFeel extends LookAndFeel "Tree.rightChildIndent", new Integer(13), "Tree.rowHeight", new Integer(16), "Tree.scrollsOnExpand", Boolean.TRUE, - "Tree.selectionBackground", new ColorUIResource(lightPurple), + "Tree.selectionBackground", new ColorUIResource(Color.black), "Tree.selectionBorderColor", new ColorUIResource(Color.black), - "Tree.selectionForeground", new ColorUIResource(Color.black), - "Tree.textBackground", new ColorUIResource(Color.lightGray), + "Tree.selectionForeground", new ColorUIResource(Color.white), + "Tree.textBackground", new ColorUIResource(Color.white), "Tree.textForeground", new ColorUIResource(Color.black), - "Viewport.background", new ColorUIResource(Color.lightGray), - "Viewport.font", new FontUIResource("Dialog", Font.PLAIN, 12), + "Viewport.background", new ColorUIResource(light), + "Viewport.foreground", new ColorUIResource(Color.black), + "Viewport.font", new FontUIResource("Dialog", Font.PLAIN, 12) }; defaults.putDefaults(uiDefaults); } diff --git a/libjava/javax/swing/plaf/basic/BasicMenuItemUI.java b/libjava/javax/swing/plaf/basic/BasicMenuItemUI.java index ff48a74..50af23a 100644 --- a/libjava/javax/swing/plaf/basic/BasicMenuItemUI.java +++ b/libjava/javax/swing/plaf/basic/BasicMenuItemUI.java @@ -605,7 +605,17 @@ public class BasicMenuItemUI extends MenuItemUI if (text != null && ! text.equals("")) { if (menuItem.isEnabled()) - g.setColor(menuItem.getForeground()); + { + /* Menu item is considered to be highlighted when it is selected. + It is considered to be selected if menu item is inside some menu + and is armed or if it is both armed and pressed */ + if (menuItem.getModel().isArmed() + && (menuItem.getParent() instanceof MenuElement + || menuItem.getModel().isPressed())) + g.setColor(selectionForeground); + else + g.setColor(menuItem.getForeground()); + } else // FIXME: should fix this to use 'disabledForeground', but its // default value in BasicLookAndFeel is null. diff --git a/libjava/javax/swing/plaf/basic/BasicScrollBarUI.java b/libjava/javax/swing/plaf/basic/BasicScrollBarUI.java index 5dd54af..7e06067 100644 --- a/libjava/javax/swing/plaf/basic/BasicScrollBarUI.java +++ b/libjava/javax/swing/plaf/basic/BasicScrollBarUI.java @@ -818,6 +818,11 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager, scrollbar.setBorder(defaults.getBorder("ScrollBar.border")); scrollbar.setOpaque(true); + thumbColor = defaults.getColor("ScrollBar.thumb"); + thumbDarkShadowColor = defaults.getColor("ScrollBar.thumbDarkShadow"); + thumbHighlightColor = defaults.getColor("ScrollBar.thumbHighlight"); + thumbLightShadowColor = defaults.getColor("ScrollBar.thumbShadow"); + maximumThumbSize = defaults.getDimension("ScrollBar.maximumThumbSize"); minimumThumbSize = defaults.getDimension("ScrollBar.minimumThumbSize"); } diff --git a/libjava/javax/swing/plaf/metal/MetalBorders.java b/libjava/javax/swing/plaf/metal/MetalBorders.java index 8b7ebec..d5b467f 100644 --- a/libjava/javax/swing/plaf/metal/MetalBorders.java +++ b/libjava/javax/swing/plaf/metal/MetalBorders.java @@ -184,6 +184,82 @@ public class MetalBorders } /** + * A border for JScrollPanes. + */ + public static class ScrollPaneBorder + extends AbstractBorder + implements UIResource + { + /** The border insets. */ + private static Insets insets = new Insets(1, 1, 2, 2); + + /** + * Constructs a new ScrollPaneBorder. + */ + public ScrollPaneBorder() + { + } + + /** + * Returns the insets of the border for the Component <code>c</code>. + * + * @param c the Component for which we return the border insets + */ + public Insets getBorderInsets(Component c) + { + return insets; + } + + /** + * Paints the border. + * + * @param c the Component for which the border is painted + * @param g the Graphics context + * @param x the X coordinate of the upper left corner of the border + * @param y the Y coordinate of the upper left corner of the border + * @param w the width of the border + * @param h the height of the border + */ + public void paintBorder(Component c, Graphics g, int x, int y, + int w, int h) + { + Color darkShadow = MetalLookAndFeel.getControlDarkShadow(); + Color shadow = MetalLookAndFeel.getControlShadow(); + Color light = MetalLookAndFeel.getWhite(); + Color middle = MetalLookAndFeel.getControl(); + + // paint top border line + g.setColor(darkShadow); + g.drawLine(x, y, x + w - 2, y); + + // paint left border line + g.drawLine(x, y, x, y + h - 2); + + // paint right inner border line + g.drawLine(x + w - 2, y, x + w - 2, y + h + 1); + + // paint bottom inner border line + g.drawLine(x + 2, y + h - 2, x + w - 2, y + h - 2); + + // draw right outer border line + g.setColor(light); + g.drawLine(x + w - 1, y, x + w - 1, y + h - 1); + + // draw bottom outer border line + g.drawLine(x, y + h - 1, x + w - 1, y + h - 1); + + // paint the lighter points + g.setColor(middle); + g.drawLine(x + w - 1, y, x + w - 1, y); + g.drawLine(x + w - 2, y + 2, x + w - 2, y + 2); + g.drawLine(x, y + h - 1, x, y + h - 1); + g.drawLine(x + 1, y + h - 2, x + 1, y + h - 2); + + } + + } + + /** * This border is used in Toolbar buttons as inner border. */ static class RolloverMarginBorder extends AbstractBorder diff --git a/libjava/javax/swing/plaf/metal/MetalLookAndFeel.java b/libjava/javax/swing/plaf/metal/MetalLookAndFeel.java index a55bc1b..edeff18 100644 --- a/libjava/javax/swing/plaf/metal/MetalLookAndFeel.java +++ b/libjava/javax/swing/plaf/metal/MetalLookAndFeel.java @@ -474,6 +474,7 @@ public class MetalLookAndFeel extends BasicLookAndFeel "Slider.background", new ColorUIResource(getControl()), "OptionPane.background", new ColorUIResource(getControl()), "ProgressBar.background", new ColorUIResource(getControl()), + "ScrollPane.border", new MetalBorders.ScrollPaneBorder(), "TabbedPane.background", new ColorUIResource(getControl()), "Label.background", new ColorUIResource(getControl()), "Label.font", getControlTextFont(), diff --git a/libjava/javax/swing/plaf/metal/MetalTextFieldUI.java b/libjava/javax/swing/plaf/metal/MetalTextFieldUI.java index 79ae2b0..d2e9ea5 100644 --- a/libjava/javax/swing/plaf/metal/MetalTextFieldUI.java +++ b/libjava/javax/swing/plaf/metal/MetalTextFieldUI.java @@ -38,6 +38,8 @@ exception statement from your version. */ package javax.swing.plaf.metal; +import java.util.HashMap; + import javax.swing.JComponent; import javax.swing.plaf.ComponentUI; import javax.swing.plaf.basic.BasicTextFieldUI; @@ -46,9 +48,8 @@ public class MetalTextFieldUI extends BasicTextFieldUI { - // FIXME: maybe replace by a Map of instances when this becomes stateful - /** The shared UI instance for MetalTextFieldUIs */ - private static MetalTextFieldUI instance = null; + /** The UI instances for MetalTextFieldUIs */ + private static HashMap instances = null; /** * Constructs a new instance of MetalTextFieldUI. @@ -67,8 +68,19 @@ public class MetalTextFieldUI */ public static ComponentUI createUI(JComponent component) { - if (instance == null) - instance = new MetalTextFieldUI(); + if (instances == null) + instances = new HashMap(); + + Object o = instances.get(component); + MetalTextFieldUI instance; + if (o == null) + { + instance = new MetalTextFieldUI(); + instances.put(component, instance); + } + else + instance = (MetalTextFieldUI) o; + return instance; } } |