Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
MatrixLookAndFeel.java
1 
16 package net.squiz.matrix.plaf;
17 
18 import net.squiz.matrix.core.*;
19 import javax.swing.*;
20 import javax.swing.border.*;
21 import javax.swing.plaf.metal.*;
22 import com.sun.java.swing.plaf.windows.*;
23 import java.awt.*;
24 import javax.swing.plaf.*;
25 
26 public class MatrixLookAndFeel extends MetalLookAndFeel implements MatrixConstants {
27 
28  public static Color PANEL_COLOUR = new Color(0xF5F5F5);
29  public static Color PANEL_BORDER_COLOUR = new Color(0xC3C3C3);
30 
31  protected void initClassDefaults(UIDefaults table) {
32  super.initClassDefaults(table);
33  String packageName = "net.squiz.matrix.plaf.";
34  Object[] uiDefaults = {
35  "SplitPaneUI", packageName + "MatrixSplitPaneUI",
36  };
37 
38  table.putDefaults(uiDefaults);
39  }
40 
41  protected void initComponentDefaults(UIDefaults table) {
42  super.initComponentDefaults(table);
43 
44  Object[] defaults = {
45  "StatusBar.border", new LineBorder(PANEL_BORDER_COLOUR),
46  "StatusBar.background", PANEL_COLOUR,
47  "SplitPane.border", new LineBorder(PANEL_BORDER_COLOUR),
48  "SplitPaneDivider.buttonbackground", PANEL_COLOUR, // matrix specific
49  "SplitPaneDivider.buttonforeground", PANEL_BORDER_COLOUR, // matrix specific
50  "SplitPaneDivider.buttonbordercolor", new Color(0x3B3B3B), // matrix specific
51  "SplitPaneDivider.border", new LineBorder(PANEL_BORDER_COLOUR),
52 
53  "SplitPane.background", PANEL_COLOUR,
54  "Tree.expandedIcon", new WindowsTreeUI.ExpandedIcon(),
55  "Tree.collapsedIcon", new WindowsTreeUI.CollapsedIcon(),
56  //"ScrollBar.shadow", new Color(0x000000), // left line in scrollbar track
57  "ScrollBar.thumb", PANEL_COLOUR, // background of the scrollbar
58  "ScrollBar.thumbShadow", PANEL_BORDER_COLOUR, // scrollbar border
59  "ScrollBar.thumbHighlight", PANEL_COLOUR, // scrollbar dots
60  "ScrollBar.track", PANEL_COLOUR,
61  "ScrollBar.trackHighlightColor", PANEL_COLOUR,
62  "ScrollBar.background", PANEL_COLOUR, // track background
63  //"ScrollBar.foreground", Color.blue,
64  "ScrollBar.darkShadow", PANEL_BORDER_COLOUR,
65 
66  "TabbedPane.tabAreaBackground", Color.RED, // doesnt seem to do much
67  "TabbedPane.selected", PANEL_COLOUR, // selected tab
68 
69  "TabbedPane.selectHighlight", PANEL_BORDER_COLOUR, // selected tab border
70  "TabbedPane.background", PANEL_BORDER_COLOUR, // other tabs
71 
72  "TabbedPane.foreground", Color.BLACK, // text color
73  "TabbedPane.light", PANEL_BORDER_COLOUR.brighter(), // other tab border
74  "TabbedPane.highlight", PANEL_BORDER_COLOUR.brighter().brighter(), // nothing
75  "TabbedPane.shadow", PANEL_BORDER_COLOUR.darker(), // all tab borders
76  "TabbedPane.darkShadow", PANEL_BORDER_COLOUR.darker().darker(), // all tab borders
77  "TabbedPane.font", PLAIN_FONT_10,
78 
79  "VerticalTextIcon.font", PLAIN_FONT_10,
80 
81  //"SplitPane.dividerSize", new Integer(10),
82 
83  "MenuItem.background", PANEL_COLOUR,
84  "Menu.background", PANEL_COLOUR,
85  //"MenuItem.border", new LineBorder(PANEL_BORDER_COLOUR),
86  //"Menu.border", PANEL_BORDER_COLOUR,
87  "PopupMenu.border", new LineBorder(PANEL_BORDER_COLOUR),
88  "MenuItem.selectionBackground", PANEL_BORDER_COLOUR,
89  "Menu.selectionBackground", PANEL_BORDER_COLOUR,
90 
91  "SelectionTool.background", PANEL_BORDER_COLOUR, // matrix specific
92  "SelectionTool.bordercolor", PANEL_BORDER_COLOUR, // matrix specific
93 
94  "InspectorNavigator.background", PANEL_COLOUR,
95 
96  "MenuItem.font", PLAIN_FONT_10,
97  "Menu.font", PLAIN_FONT_10,
98 
99  "CueLine.stroke", Color.BLACK,
100 
101  };
102  table.putDefaults(defaults);
103  }
104 
105  protected void initSystemColorDefaults(UIDefaults table) {
106  super.initSystemColorDefaults(table);
107 
108  Object[] systemColors = {
109  "scrollbar", PANEL_BORDER_COLOUR,
110  };
111 
112  for (int i = 0; i < systemColors.length; i += 2) {
113  table.put((String) systemColors[i], systemColors[i + 1]);
114  }
115  }
116 }