/* * mytheme.bsh -- An example of implementing a custom * MetalTheme in beanshell. * * Usage: save this file in ${HOME}/.jedit/startup/mytheme.bsh, and * restart jEdit if necessary, and tweak color values as you see * fit. * * The Javadocs for * MetalTheme and * DefaultMetalTheme * are helpful. * * delvinj@gmail.com (d delvin johnson) * Oct 6, 2005 */ import javax.swing.border.*; import javax.swing.plaf.*; import javax.swing.plaf.metal.*; void useMetal() { UIManager.put("MenuBar.border", new BorderUIResource( BorderFactory.createCompoundBorder( BorderFactory.createMatteBorder(0,0,1,0, new Color(0xB4B4C0)), BorderFactory.createEmptyBorder(2,3,2,2)))); UIManager.put("Tree.rowHeight", new Integer(22)); UIManager.put("TabbedPane.tabAreaInsets", new InsetsUIResource(4,2,0,2)); UIManager.put("TabbedPane.tabInsets", new InsetsUIResource(8,8,0,8)); String myThemeName = "ChickenSandwich"; ColorUIResource s3 = new ColorUIResource(213,209,203); ColorUIResource p3 = new ColorUIResource(40,100,140); MetalTheme myMetalTheme = new DefaultMetalTheme() { public String getName() { return myThemeName; } public ColorUIResource getHighlightedTextColor() { return super.getWhite(); } public ColorUIResource getTextHighlightColor() { return p3; } public ColorUIResource getSecondary3() { return s3; } public ColorUIResource getMenuSelectedBackground() { return p3; } public ColorUIResource getMenuSelectedForeground() { return getWhite(); } public ColorUIResource getAcceleratorSelectedForeground() { return getWhite(); } }; MetalLookAndFeel.setCurrentTheme(myMetalTheme); try { UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel"); } catch(Exception x) { } } useMetal();