1
36
37
40
41
42 import javax.swing.plaf.*;
43 import javax.swing.plaf.basic.*;
44 import javax.swing.plaf.metal.*;
45 import javax.swing.*;
46 import javax.swing.border.*;
47 import java.awt.*;
48
49
55
56 public class ContrastTheme extends DefaultMetalTheme {
57
58 public String getName() { return "Contrast"; }
59
60 private final ColorUIResource primary1 = new ColorUIResource(0, 0, 0);
61 private final ColorUIResource primary2 = new ColorUIResource(204, 204, 204);
62 private final ColorUIResource primary3 = new ColorUIResource(255, 255, 255);
63 private final ColorUIResource primaryHighlight = new ColorUIResource(102,102,102);
64
65 private final ColorUIResource secondary2 = new ColorUIResource(204, 204, 204);
66 private final ColorUIResource secondary3 = new ColorUIResource(255, 255, 255);
67 private final ColorUIResource controlHighlight = new ColorUIResource(102,102,102);
68
69 protected ColorUIResource getPrimary1() { return primary1; }
70 protected ColorUIResource getPrimary2() { return primary2; }
71 protected ColorUIResource getPrimary3() { return primary3; }
72 public ColorUIResource getPrimaryControlHighlight() { return primaryHighlight;}
73
74 protected ColorUIResource getSecondary2() { return secondary2; }
75 protected ColorUIResource getSecondary3() { return secondary3; }
76 public ColorUIResource getControlHighlight() { return super.getSecondary3(); }
77
78 public ColorUIResource getFocusColor() { return getBlack(); }
79
80 public ColorUIResource getTextHighlightColor() { return getBlack(); }
81 public ColorUIResource getHighlightedTextColor() { return getWhite(); }
82
83 public ColorUIResource getMenuSelectedBackground() { return getBlack(); }
84 public ColorUIResource getMenuSelectedForeground() { return getWhite(); }
85 public ColorUIResource getAcceleratorForeground() { return getBlack(); }
86 public ColorUIResource getAcceleratorSelectedForeground() { return getWhite(); }
87
88
89 public void addCustomEntriesToTable(UIDefaults table) {
90
91 Border blackLineBorder = new BorderUIResource(new LineBorder( getBlack() ));
92
93 Object textBorder = new BorderUIResource( new CompoundBorder(
94 blackLineBorder,
95 new BasicBorders.MarginBorder()));
96
97 table.put( "ToolTip.border", blackLineBorder);
98 table.put( "TitledBorder.border", blackLineBorder);
99
100 table.put( "TextField.border", textBorder);
101 table.put( "PasswordField.border", textBorder);
102 table.put( "TextArea.border", textBorder);
103 table.put( "TextPane.border", textBorder);
104 table.put( "EditorPane.border", textBorder);
105
106
107 }
108
109 }
110