home *** CD-ROM | disk | FTP | other *** search
/ Australian PC Authority 1999 May / may1999.iso / May / JBUILDER / JSAMPLES.Z / ContrastMetalTheme.class (.txt) < prev    next >
Encoding:
Java Class File  |  1998-04-30  |  2.5 KB  |  86 lines

  1. import com.sun.java.swing.UIDefaults;
  2. import com.sun.java.swing.border.LineBorder;
  3. import com.sun.java.swing.plaf.BorderUIResource;
  4. import com.sun.java.swing.plaf.ColorUIResource;
  5. import com.sun.java.swing.plaf.metal.DefaultMetalTheme;
  6. import com.sun.java.swing.plaf.metal.MetalTheme;
  7.  
  8. public class ContrastMetalTheme extends DefaultMetalTheme {
  9.    private final ColorUIResource primary1 = new ColorUIResource(0, 0, 0);
  10.    private final ColorUIResource primary2 = new ColorUIResource(204, 204, 204);
  11.    private final ColorUIResource primary3 = new ColorUIResource(255, 255, 255);
  12.    private final ColorUIResource primaryHighlight = new ColorUIResource(102, 102, 102);
  13.    private final ColorUIResource secondary2 = new ColorUIResource(204, 204, 204);
  14.    private final ColorUIResource secondary3 = new ColorUIResource(255, 255, 255);
  15.    private final ColorUIResource controlHighlight = new ColorUIResource(102, 102, 102);
  16.  
  17.    public String getName() {
  18.       return "Contrast";
  19.    }
  20.  
  21.    protected ColorUIResource getPrimary1() {
  22.       return this.primary1;
  23.    }
  24.  
  25.    protected ColorUIResource getPrimary2() {
  26.       return this.primary2;
  27.    }
  28.  
  29.    protected ColorUIResource getPrimary3() {
  30.       return this.primary3;
  31.    }
  32.  
  33.    public ColorUIResource getPrimaryControlHighlight() {
  34.       return this.primaryHighlight;
  35.    }
  36.  
  37.    protected ColorUIResource getSecondary2() {
  38.       return this.secondary2;
  39.    }
  40.  
  41.    protected ColorUIResource getSecondary3() {
  42.       return this.secondary3;
  43.    }
  44.  
  45.    public ColorUIResource getControlHighlight() {
  46.       return super.getSecondary3();
  47.    }
  48.  
  49.    public ColorUIResource getFocusColor() {
  50.       return ((MetalTheme)this).getBlack();
  51.    }
  52.  
  53.    public ColorUIResource getTextHighlightColor() {
  54.       return ((MetalTheme)this).getBlack();
  55.    }
  56.  
  57.    public ColorUIResource getHighlightedTextColor() {
  58.       return ((MetalTheme)this).getWhite();
  59.    }
  60.  
  61.    public ColorUIResource getMenuSelectedBackground() {
  62.       return ((MetalTheme)this).getBlack();
  63.    }
  64.  
  65.    public ColorUIResource getMenuSelectedForeground() {
  66.       return ((MetalTheme)this).getWhite();
  67.    }
  68.  
  69.    public ColorUIResource getAcceleratorForeground() {
  70.       return ((MetalTheme)this).getBlack();
  71.    }
  72.  
  73.    public ColorUIResource getAcceleratorSelectedForeground() {
  74.       return ((MetalTheme)this).getWhite();
  75.    }
  76.  
  77.    public void addCustomEntriesToTable(UIDefaults var1) {
  78.       BorderUIResource var2 = new BorderUIResource(new LineBorder(((MetalTheme)this).getBlack()));
  79.       BorderUIResource var3 = new BorderUIResource(new LineBorder(((MetalTheme)this).getWhite()));
  80.       var1.put("ToolTip.border", var2);
  81.       var1.put("TitledBorder.border", var2);
  82.       var1.put("Table.focusCellHighlightBorder", var3);
  83.       var1.put("Table.focusCellForeground", ((MetalTheme)this).getWhite());
  84.    }
  85. }
  86.