jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsLookAndFeel.java
changeset 11975 d3620e28371c
parent 10413 5bd4f81b6d45
child 13779 011727a60840
equal deleted inserted replaced
11818:726dedadcc44 11975:d3620e28371c
    53 import javax.swing.border.*;
    53 import javax.swing.border.*;
    54 import javax.swing.text.DefaultEditorKit;
    54 import javax.swing.text.DefaultEditorKit;
    55 
    55 
    56 import java.awt.Font;
    56 import java.awt.Font;
    57 import java.awt.Color;
    57 import java.awt.Color;
    58 import java.awt.event.KeyEvent;
       
    59 import java.awt.event.ActionEvent;
    58 import java.awt.event.ActionEvent;
    60 
    59 
    61 import java.security.AccessController;
    60 import java.security.AccessController;
    62 
    61 
    63 import sun.awt.SunToolkit;
    62 import sun.awt.SunToolkit;
   521                                                        "win.text.grayedTextColor",
   520                                                        "win.text.grayedTextColor",
   522                                                         table.get("textInactiveText"));
   521                                                         table.get("textInactiveText"));
   523         Object ScrollbarBackgroundColor = new DesktopProperty(
   522         Object ScrollbarBackgroundColor = new DesktopProperty(
   524                                                        "win.scrollbar.backgroundColor",
   523                                                        "win.scrollbar.backgroundColor",
   525                                                         table.get("scrollbar"));
   524                                                         table.get("scrollbar"));
       
   525         Object buttonFocusColor = new FocusColorProperty();
   526 
   526 
   527         Object TextBackground         = new XPColorValue(Part.EP_EDIT, null, Prop.FILLCOLOR,
   527         Object TextBackground         = new XPColorValue(Part.EP_EDIT, null, Prop.FILLCOLOR,
   528                                                          WindowBackgroundColor);
   528                                                          WindowBackgroundColor);
   529         //The following four lines were commented out as part of bug 4991597
   529         //The following four lines were commented out as part of bug 4991597
   530         //This code *is* correct, however it differs from WindowsXP and is, apparently
   530         //This code *is* correct, however it differs from WindowsXP and is, apparently
   627             "Button.darkShadow", ControlDarkShadowColor,
   627             "Button.darkShadow", ControlDarkShadowColor,
   628             "Button.light", ControlLightColor,
   628             "Button.light", ControlLightColor,
   629             "Button.highlight", ControlHighlightColor,
   629             "Button.highlight", ControlHighlightColor,
   630             "Button.disabledForeground", InactiveTextColor,
   630             "Button.disabledForeground", InactiveTextColor,
   631             "Button.disabledShadow", ControlHighlightColor,
   631             "Button.disabledShadow", ControlHighlightColor,
   632             "Button.focus", black,
   632             "Button.focus", buttonFocusColor,
   633             "Button.dashedRectGapX", new XPValue(Integer.valueOf(3), Integer.valueOf(5)),
   633             "Button.dashedRectGapX", new XPValue(Integer.valueOf(3), Integer.valueOf(5)),
   634             "Button.dashedRectGapY", new XPValue(Integer.valueOf(3), Integer.valueOf(4)),
   634             "Button.dashedRectGapY", new XPValue(Integer.valueOf(3), Integer.valueOf(4)),
   635             "Button.dashedRectGapWidth", new XPValue(Integer.valueOf(6), Integer.valueOf(10)),
   635             "Button.dashedRectGapWidth", new XPValue(Integer.valueOf(6), Integer.valueOf(10)),
   636             "Button.dashedRectGapHeight", new XPValue(Integer.valueOf(6), Integer.valueOf(8)),
   636             "Button.dashedRectGapHeight", new XPValue(Integer.valueOf(6), Integer.valueOf(8)),
   637             "Button.textShiftOffset", new XPValue(Integer.valueOf(0),
   637             "Button.textShiftOffset", new XPValue(Integer.valueOf(0),
   650             "CheckBox.foreground", WindowTextColor,
   650             "CheckBox.foreground", WindowTextColor,
   651             "CheckBox.shadow", ControlShadowColor,
   651             "CheckBox.shadow", ControlShadowColor,
   652             "CheckBox.darkShadow", ControlDarkShadowColor,
   652             "CheckBox.darkShadow", ControlDarkShadowColor,
   653             "CheckBox.light", ControlLightColor,
   653             "CheckBox.light", ControlLightColor,
   654             "CheckBox.highlight", ControlHighlightColor,
   654             "CheckBox.highlight", ControlHighlightColor,
   655             "CheckBox.focus", black,
   655             "CheckBox.focus", buttonFocusColor,
   656             "CheckBox.focusInputMap",
   656             "CheckBox.focusInputMap",
   657                new UIDefaults.LazyInputMap(new Object[] {
   657                new UIDefaults.LazyInputMap(new Object[] {
   658                             "SPACE", "pressed",
   658                             "SPACE", "pressed",
   659                    "released SPACE", "released"
   659                    "released SPACE", "released"
   660                  }),
   660                  }),
  1005             "RadioButton.foreground", WindowTextColor,
  1005             "RadioButton.foreground", WindowTextColor,
  1006             "RadioButton.shadow", ControlShadowColor,
  1006             "RadioButton.shadow", ControlShadowColor,
  1007             "RadioButton.darkShadow", ControlDarkShadowColor,
  1007             "RadioButton.darkShadow", ControlDarkShadowColor,
  1008             "RadioButton.light", ControlLightColor,
  1008             "RadioButton.light", ControlLightColor,
  1009             "RadioButton.highlight", ControlHighlightColor,
  1009             "RadioButton.highlight", ControlHighlightColor,
  1010             "RadioButton.focus", black,
  1010             "RadioButton.focus", buttonFocusColor,
  1011             "RadioButton.focusInputMap",
  1011             "RadioButton.focusInputMap",
  1012                new UIDefaults.LazyInputMap(new Object[] {
  1012                new UIDefaults.LazyInputMap(new Object[] {
  1013                           "SPACE", "pressed",
  1013                           "SPACE", "pressed",
  1014                  "released SPACE", "released"
  1014                  "released SPACE", "released"
  1015               }),
  1015               }),
  2612                          (int)(avg   * 255f);
  2612                          (int)(avg   * 255f);
  2613             return rgbval;
  2613             return rgbval;
  2614         }
  2614         }
  2615     }
  2615     }
  2616 
  2616 
       
  2617     private static class FocusColorProperty extends DesktopProperty {
       
  2618         public FocusColorProperty () {
       
  2619             // Fallback value is never used bacause of the configureValue method doesn't return null
       
  2620             super("win.3d.backgroundColor", Color.BLACK);
       
  2621         }
       
  2622 
       
  2623         @Override
       
  2624         protected Object configureValue(Object value) {
       
  2625             if (! ((Boolean)Toolkit.getDefaultToolkit().getDesktopProperty("win.highContrast.on")).booleanValue()){
       
  2626                 return Color.BLACK;
       
  2627             }
       
  2628             return Color.BLACK.equals(value) ? Color.WHITE : Color.BLACK;
       
  2629         }
       
  2630     }
       
  2631 
  2617 }
  2632 }