Mercurial > hg > jslab
comparison src/samer/core_/util/swing/DarkMetalTheme.java @ 0:bf79fb79ee13
Initial Mercurial check in.
author | samer |
---|---|
date | Tue, 17 Jan 2012 17:50:20 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:bf79fb79ee13 |
---|---|
1 package samer.core.util.swing; | |
2 | |
3 import javax.swing.plaf.*; | |
4 import javax.swing.*; | |
5 import java.awt.*; | |
6 | |
7 public class DarkMetalTheme extends javax.swing.plaf.metal.MetalTheme { | |
8 | |
9 private ColorUIResource primary1; | |
10 private ColorUIResource primary2; | |
11 private ColorUIResource primary3; | |
12 private ColorUIResource red, blue, yellow, green, highlight; | |
13 | |
14 private ColorUIResource secondary1; | |
15 private ColorUIResource secondary2; | |
16 private ColorUIResource secondary3; | |
17 private ColorUIResource white; | |
18 | |
19 private FontUIResource plainFont; | |
20 private FontUIResource smallFont; | |
21 private FontUIResource boldFont; | |
22 | |
23 public String getName() { return "Silk"; } | |
24 | |
25 public DarkMetalTheme(Font font, Color bg, double hue, double sat) | |
26 { | |
27 System.err.println("Metal theme: base font is "+font); | |
28 | |
29 plainFont = new FontUIResource(font); | |
30 smallFont = new FontUIResource(font.deriveFont(0.8f*font.getSize2D())); | |
31 boldFont = new FontUIResource(font.deriveFont(Font.BOLD)); | |
32 | |
33 primary3 = new ColorUIResource(Color.getHSBColor((float)hue,(float)sat,.5f)); | |
34 primary2 =new ColorUIResource(Color.getHSBColor((float)hue,(float)sat,.3f)); | |
35 primary1 =new ColorUIResource(Color.getHSBColor((float)hue,(float)sat,.1f)); | |
36 | |
37 secondary3 = new ColorUIResource(bg); | |
38 secondary2 = new ColorUIResource(bg.darker()); | |
39 secondary1 = new ColorUIResource(bg.darker().darker()); | |
40 highlight = new ColorUIResource(bg.brighter()); | |
41 | |
42 | |
43 white=new ColorUIResource(Color.white.darker()); | |
44 red=new ColorUIResource(Color.red); | |
45 blue=new ColorUIResource(Color.blue); | |
46 green=new ColorUIResource(Color.green); | |
47 yellow=new ColorUIResource(Color.yellow); | |
48 } | |
49 | |
50 public void addCustomEntriesToTable(UIDefaults table) | |
51 { | |
52 table.put( "Button.font", boldFont); | |
53 table.put( "Label.foreground", getWhite()); | |
54 table.put( "TextField.background", secondary2); | |
55 table.put( "TextField.foreground", getWhite()); | |
56 table.put( "TitledBorder.font", boldFont); | |
57 table.put( "List.background", getBlack()); | |
58 table.put( "List.foreground", getWhite()); | |
59 table.put( "List.font", plainFont); | |
60 } | |
61 | |
62 public ColorUIResource getWhite() { return white; } | |
63 public ColorUIResource getPrimary1() { return primary1; } | |
64 public ColorUIResource getPrimary2() { return primary2; } | |
65 public ColorUIResource getPrimary3() { return primary3; } | |
66 | |
67 public ColorUIResource getSecondary1() { return secondary1; } | |
68 public ColorUIResource getSecondary2() { return secondary2; } | |
69 public ColorUIResource getSecondary3() { return secondary3; } | |
70 | |
71 public FontUIResource getControlTextFont() { return plainFont;} | |
72 public FontUIResource getSystemTextFont() { return plainFont;} | |
73 public FontUIResource getUserTextFont() { return plainFont;} | |
74 public FontUIResource getMenuTextFont() { return plainFont;} | |
75 public FontUIResource getWindowTitleFont() { return boldFont;} | |
76 public FontUIResource getSubTextFont() { return smallFont;} | |
77 | |
78 public ColorUIResource getMenuForeground() { return getWhite(); } | |
79 public ColorUIResource getMenuSelectedForeground() { return getWhite(); } | |
80 | |
81 // these are for tweaking | |
82 | |
83 public ColorUIResource getDesktopColor() { return getPrimary1(); } | |
84 | |
85 public ColorUIResource getControl() { return getSecondary3(); } | |
86 public ColorUIResource getControlShadow() { return getSecondary2(); } | |
87 public ColorUIResource getControlDarkShadow() { return getSecondary1(); } | |
88 public ColorUIResource getControlInfo() { return getWhite(); } | |
89 public ColorUIResource getControlHighlight() { return highlight; } // getWhite(); } | |
90 // public ColorUIResource getControlDisabled() { return getSecondary2(); } | |
91 | |
92 // public ColorUIResource getPrimaryControl() { return getPrimary3(); } | |
93 // public ColorUIResource getPrimaryControlShadow() { return getPrimary2(); } | |
94 // public ColorUIResource getPrimaryControlDarkShadow() { return getPrimary1(); } | |
95 public ColorUIResource getPrimaryControlInfo() { return primary2; } // getWhite(); } | |
96 public ColorUIResource getPrimaryControlHighlight() { return primary3; } // getWhite(); } | |
97 | |
98 public ColorUIResource getSystemTextColor() { return getWhite(); } | |
99 // public ColorUIResource getInactiveSystemTextColor() { return getSecondary2(); } | |
100 | |
101 public ColorUIResource getSeparatorBackground() { return highlight; } // getWhite(); } | |
102 public ColorUIResource getSeparatorForeground() { return getSecondary2(); } // getPrimary1(); } | |
103 } |