Mercurial > hg > jslab
view src/samer/core_/util/swing/SilkyMetalTheme.java @ 8:5e3cbbf173aa tip
Reorganise some more
author | samer |
---|---|
date | Fri, 05 Apr 2019 22:41:58 +0100 |
parents | bf79fb79ee13 |
children |
line wrap: on
line source
package samer.core.util.swing; import javax.swing.plaf.*; import javax.swing.*; import java.awt.*; public class SilkyMetalTheme extends javax.swing.plaf.metal.MetalTheme { private ColorUIResource primary1; private ColorUIResource primary2; private ColorUIResource primary3; private ColorUIResource red, blue, yellow, green, highlight; private ColorUIResource secondary1; private ColorUIResource secondary2; private ColorUIResource secondary3; private FontUIResource plainFont; private FontUIResource smallFont; private FontUIResource boldFont; public String getName() { return "Silk"; } public SilkyMetalTheme(Font font, Color bg, double hue) { System.err.println("Metal theme: base font is "+font); plainFont = new FontUIResource(font); smallFont = new FontUIResource(font.deriveFont(0.8f*font.getSize2D())); boldFont = new FontUIResource(font.deriveFont(Font.BOLD)); primary3 = new ColorUIResource(Color.getHSBColor((float)hue,0.3f,1.0f)); primary2 =new ColorUIResource(Color.getHSBColor((float)hue,0.4f,.9f)); primary1 =new ColorUIResource(Color.getHSBColor((float)hue,0.3f,.3f)); secondary3 = new ColorUIResource(bg); secondary2 = new ColorUIResource(bg.darker()); secondary1 = new ColorUIResource(bg.darker().darker()); highlight = new ColorUIResource(bg.brighter()); red=new ColorUIResource(Color.red); blue=new ColorUIResource(Color.blue); green=new ColorUIResource(Color.green); yellow=new ColorUIResource(Color.yellow); } public void addCustomEntriesToTable(UIDefaults table) { table.put( "Button.font", boldFont); table.put( "Label.foreground", getBlack()); table.put( "TitledBorder.font", boldFont); table.put( "List.font", plainFont); } public ColorUIResource getPrimary1() { return primary1; } public ColorUIResource getPrimary2() { return primary2; } public ColorUIResource getPrimary3() { return primary3; } public ColorUIResource getSecondary1() { return secondary1; } public ColorUIResource getSecondary2() { return secondary2; } public ColorUIResource getSecondary3() { return secondary3; } public FontUIResource getControlTextFont() { return plainFont;} public FontUIResource getSystemTextFont() { return plainFont;} public FontUIResource getUserTextFont() { return plainFont;} public FontUIResource getMenuTextFont() { return plainFont;} public FontUIResource getWindowTitleFont() { return boldFont;} public FontUIResource getSubTextFont() { return smallFont;} // these are fore tweaking public ColorUIResource getDesktopColor() { return getPrimary1(); } public ColorUIResource getControl() { return getSecondary3(); } public ColorUIResource getControlShadow() { return getSecondary2(); } public ColorUIResource getControlDarkShadow() { return getSecondary1(); } // public ColorUIResource getControlInfo() { return getBlack(); } public ColorUIResource getControlHighlight() { return highlight; } // getWhite(); } // public ColorUIResource getControlDisabled() { return getSecondary2(); } // public ColorUIResource getPrimaryControl() { return getPrimary3(); } // public ColorUIResource getPrimaryControlShadow() { return getPrimary2(); } // public ColorUIResource getPrimaryControlDarkShadow() { return getPrimary1(); } // public ColorUIResource getPrimaryControlInfo() { return getBlack(); } public ColorUIResource getPrimaryControlHighlight() { return highlight; } // getWhite(); } // public ColorUIResource getSystemTextColor() { return getPrimary1(); } // public ColorUIResource getInactiveSystemTextColor() { return getSecondary2(); } public ColorUIResource getSeparatorBackground() { return highlight; } // getWhite(); } public ColorUIResource getSeparatorForeground() { return getSecondary2(); } // getPrimary1(); } }