1 19 package org.openharmonise.him.window.swing; 20 21 import java.awt.*; 22 23 import javax.swing.*; 24 import javax.swing.plaf.*; 25 import javax.swing.plaf.metal.*; 26 27 import org.openharmonise.him.configuration.lnf.*; 28 import org.openharmonise.vfs.gui.IconManager; 29 30 34 public class SimulacraLnF extends DefaultMetalTheme { 35 private final ColorUIResource primary1 = new ColorUIResource(0, 0, 0); 36 private FontUIResource boldFont; 37 private FontUIResource plainFont; 38 39 public SimulacraLnF() { 40 String fontName = "Dialog"; 41 int fontSize = 11; 42 Font font = new Font(fontName, Font.PLAIN, fontSize); 43 plainFont = new FontUIResource(font); 44 font = new Font(fontName, Font.BOLD, fontSize); 45 boldFont = new FontUIResource(font); 46 } 47 48 public static void setLookAndFeel() { 49 UIManager.LookAndFeelInfo[] array = UIManager.getInstalledLookAndFeels(); 52 for(int i = 0; i < array.length; i++) { 53 UIManager.LookAndFeelInfo info = array[i]; 54 } 55 String lookAndFeelClassName = "com.birosoft.liquid.LiquidLookAndFeel"; 56 57 MetalLookAndFeel.setCurrentTheme(new SimulacraLnF()); 58 UIManager.put("Tree.collapsedIcon", 59 IconManager.getInstance().getIcon("16-tree-collapsed.gif")); 60 UIManager.put("Tree.expandedIcon", 61 IconManager.getInstance().getIcon("16-tree-expanded.gif")); 62 63 ToolTipManager.sharedInstance().setInitialDelay(1000); 64 ToolTipManager.sharedInstance().setDismissDelay(2000); 65 ToolTipManager.sharedInstance().setReshowDelay(1500); 66 67 try { 68 UIManager.setLookAndFeel(lookAndFeelClassName); 69 70 LookAndFeelConfigOptions config = new LookAndFeelConfigOptions(); 71 config.setStoredLnF(); 72 } catch (Exception e) { 73 e.printStackTrace(); 74 } 75 } 76 77 public FontUIResource getControlTextFont() { 78 return plainFont; 79 } 80 81 public FontUIResource getMenuTextFont() { 82 return plainFont; 83 } 84 85 public FontUIResource getSubTextFont() { 86 return plainFont; 87 } 88 89 public FontUIResource getSystemTextFont() { 90 return plainFont; 91 } 92 93 public FontUIResource getUserTextFont() { 94 return plainFont; 95 } 96 97 public FontUIResource getWindowTitleFont() { 98 return plainFont; 99 } 100 101 public void addCustomEntriesToTable(UIDefaults table) { 102 table.put("TextField.border", BorderFactory.createLoweredBevelBorder()); 103 table.put("SplitPaneUI", "javax.swing.plaf.basic.BasicSplitPaneUI"); 104 table.put("ScrollBarUI", "javax.swing.plaf.basic.BasicScrollBarUI"); 105 table.put("TreeUI", "javax.swing.plaf.basic.BasicTreeUI"); 106 table.put("SplitPane.dividerSize", new Integer (7)); 107 table.put("ScrollBar.background", new Color(0xe0e0e0)); 108 table.put("ScrollBar.foreground", new Color(0xc0c0c0)); 109 table.put("ScrollBar.track", new Color(0xe0e0e0)); 110 table.put("ScrollBar.trackHighlight", Color.black); 111 table.put("ScrollBar.thumb", new Color(0xc0c0c0)); 112 table.put("ScrollBar.thumbHighlight", Color.white); 113 table.put("ScrollBar.thumbDarkShadow", Color.black); 114 table.put("ScrollBar.thumbLightShadow", new Color(0x808080)); 115 table.put("Button.textIconGap", new Integer (2)); 116 table.put("Button.font", plainFont); 117 } 118 119 protected ColorUIResource getPrimary1() { 120 return primary1; 121 } 122 123 } 124 | Popular Tags |