samer@0: package samer.core.util.swing; samer@0: samer@0: import javax.swing.plaf.*; samer@0: import javax.swing.*; samer@0: import java.awt.*; samer@0: samer@0: public class DarkMetalTheme extends javax.swing.plaf.metal.MetalTheme { samer@0: samer@0: private ColorUIResource primary1; samer@0: private ColorUIResource primary2; samer@0: private ColorUIResource primary3; samer@0: private ColorUIResource red, blue, yellow, green, highlight; samer@0: samer@0: private ColorUIResource secondary1; samer@0: private ColorUIResource secondary2; samer@0: private ColorUIResource secondary3; samer@0: private ColorUIResource white; samer@0: samer@0: private FontUIResource plainFont; samer@0: private FontUIResource smallFont; samer@0: private FontUIResource boldFont; samer@0: samer@0: public String getName() { return "Silk"; } samer@0: samer@0: public DarkMetalTheme(Font font, Color bg, double hue, double sat) samer@0: { samer@0: System.err.println("Metal theme: base font is "+font); samer@0: samer@0: plainFont = new FontUIResource(font); samer@0: smallFont = new FontUIResource(font.deriveFont(0.8f*font.getSize2D())); samer@0: boldFont = new FontUIResource(font.deriveFont(Font.BOLD)); samer@0: samer@0: primary3 = new ColorUIResource(Color.getHSBColor((float)hue,(float)sat,.5f)); samer@0: primary2 =new ColorUIResource(Color.getHSBColor((float)hue,(float)sat,.3f)); samer@0: primary1 =new ColorUIResource(Color.getHSBColor((float)hue,(float)sat,.1f)); samer@0: samer@0: secondary3 = new ColorUIResource(bg); samer@0: secondary2 = new ColorUIResource(bg.darker()); samer@0: secondary1 = new ColorUIResource(bg.darker().darker()); samer@0: highlight = new ColorUIResource(bg.brighter()); samer@0: samer@0: samer@0: white=new ColorUIResource(Color.white.darker()); samer@0: red=new ColorUIResource(Color.red); samer@0: blue=new ColorUIResource(Color.blue); samer@0: green=new ColorUIResource(Color.green); samer@0: yellow=new ColorUIResource(Color.yellow); samer@0: } samer@0: samer@0: public void addCustomEntriesToTable(UIDefaults table) samer@0: { samer@0: table.put( "Button.font", boldFont); samer@0: table.put( "Label.foreground", getWhite()); samer@0: table.put( "TextField.background", secondary2); samer@0: table.put( "TextField.foreground", getWhite()); samer@0: table.put( "TitledBorder.font", boldFont); samer@0: table.put( "List.background", getBlack()); samer@0: table.put( "List.foreground", getWhite()); samer@0: table.put( "List.font", plainFont); samer@0: } samer@0: samer@0: public ColorUIResource getWhite() { return white; } samer@0: public ColorUIResource getPrimary1() { return primary1; } samer@0: public ColorUIResource getPrimary2() { return primary2; } samer@0: public ColorUIResource getPrimary3() { return primary3; } samer@0: samer@0: public ColorUIResource getSecondary1() { return secondary1; } samer@0: public ColorUIResource getSecondary2() { return secondary2; } samer@0: public ColorUIResource getSecondary3() { return secondary3; } samer@0: samer@0: public FontUIResource getControlTextFont() { return plainFont;} samer@0: public FontUIResource getSystemTextFont() { return plainFont;} samer@0: public FontUIResource getUserTextFont() { return plainFont;} samer@0: public FontUIResource getMenuTextFont() { return plainFont;} samer@0: public FontUIResource getWindowTitleFont() { return boldFont;} samer@0: public FontUIResource getSubTextFont() { return smallFont;} samer@0: samer@0: public ColorUIResource getMenuForeground() { return getWhite(); } samer@0: public ColorUIResource getMenuSelectedForeground() { return getWhite(); } samer@0: samer@0: // these are for tweaking samer@0: samer@0: public ColorUIResource getDesktopColor() { return getPrimary1(); } samer@0: samer@0: public ColorUIResource getControl() { return getSecondary3(); } samer@0: public ColorUIResource getControlShadow() { return getSecondary2(); } samer@0: public ColorUIResource getControlDarkShadow() { return getSecondary1(); } samer@0: public ColorUIResource getControlInfo() { return getWhite(); } samer@0: public ColorUIResource getControlHighlight() { return highlight; } // getWhite(); } samer@0: // public ColorUIResource getControlDisabled() { return getSecondary2(); } samer@0: samer@0: // public ColorUIResource getPrimaryControl() { return getPrimary3(); } samer@0: // public ColorUIResource getPrimaryControlShadow() { return getPrimary2(); } samer@0: // public ColorUIResource getPrimaryControlDarkShadow() { return getPrimary1(); } samer@0: public ColorUIResource getPrimaryControlInfo() { return primary2; } // getWhite(); } samer@0: public ColorUIResource getPrimaryControlHighlight() { return primary3; } // getWhite(); } samer@0: samer@0: public ColorUIResource getSystemTextColor() { return getWhite(); } samer@0: // public ColorUIResource getInactiveSystemTextColor() { return getSecondary2(); } samer@0: samer@0: public ColorUIResource getSeparatorBackground() { return highlight; } // getWhite(); } samer@0: public ColorUIResource getSeparatorForeground() { return getSecondary2(); } // getPrimary1(); } samer@0: }