1 7 8 package javax.swing.plaf.basic; 9 10 import java.awt.*; 11 import javax.swing.*; 12 import javax.swing.border.*; 13 import javax.swing.plaf.*; 14 import java.awt.*; 15 import java.awt.event.*; 16 17 18 24 public class BasicPanelUI extends PanelUI { 25 26 private static PanelUI panelUI; 28 29 public static ComponentUI createUI(JComponent c) { 30 if(panelUI == null) { 31 panelUI = new BasicPanelUI (); 32 } 33 return panelUI; 34 } 35 36 public void installUI(JComponent c) { 37 JPanel p = (JPanel)c; 38 super.installUI(p); 39 installDefaults(p); 40 } 41 42 public void uninstallUI(JComponent c) { 43 JPanel p = (JPanel)c; 44 uninstallDefaults(p); 45 super.uninstallUI(c); 46 } 47 48 protected void installDefaults(JPanel p) { 49 LookAndFeel.installColorsAndFont(p, 50 "Panel.background", 51 "Panel.foreground", 52 "Panel.font"); 53 LookAndFeel.installBorder(p,"Panel.border"); 54 LookAndFeel.installProperty(p, "opaque", Boolean.TRUE); 55 } 56 57 protected void uninstallDefaults(JPanel p) { 58 LookAndFeel.uninstallBorder(p); 59 } 60 } 61 | Popular Tags |