1 41 42 package org.jfree.ui; 43 44 import java.awt.Color ; 45 46 import javax.swing.UIDefaults ; 47 import javax.swing.UIManager ; 48 import javax.swing.border.EmptyBorder ; 49 import javax.swing.border.EtchedBorder ; 50 import javax.swing.border.MatteBorder ; 51 import javax.swing.plaf.BorderUIResource ; 52 53 58 public class UIUtilities { 59 60 63 private UIUtilities() { 64 } 65 66 69 public static void setupUI() { 70 try { 71 final String classname = UIManager.getSystemLookAndFeelClassName(); 72 UIManager.setLookAndFeel(classname); 73 } 74 catch (Exception e) { 75 e.printStackTrace(); 76 } 77 78 final UIDefaults defaults = UIManager.getDefaults(); 79 80 defaults.put( 81 "PopupMenu.border", 82 new BorderUIResource.EtchedBorderUIResource ( 83 EtchedBorder.RAISED, defaults.getColor("controlShadow"), 84 defaults.getColor("controlLtHighlight") 85 ) 86 ); 87 88 final MatteBorder matteborder = new MatteBorder (1, 1, 1, 1, Color.black); 89 final EmptyBorder emptyborder = new MatteBorder (2, 2, 2, 2, defaults.getColor("control")); 90 final BorderUIResource.CompoundBorderUIResource compBorder 91 = new BorderUIResource.CompoundBorderUIResource (emptyborder, matteborder); 92 final BorderUIResource.EmptyBorderUIResource emptyBorderUI 93 = new BorderUIResource.EmptyBorderUIResource (0, 0, 0, 0); 94 defaults.put("SplitPane.border", emptyBorderUI); 95 defaults.put("Table.scrollPaneBorder", emptyBorderUI); 96 defaults.put("ComboBox.border", compBorder); 97 defaults.put("TextField.border", compBorder); 98 defaults.put("TextArea.border", compBorder); 99 defaults.put("CheckBox.border", compBorder); 100 defaults.put("ScrollPane.border", emptyBorderUI); 101 102 } 103 104 } 105 | Popular Tags |