1 17 18 package swingwtx.swing.plaf; 19 20 import swingwtx.swing.SwingUtilities; 21 import swingwtx.swing.JComponent; 22 import swingwtx.accessibility.Accessible; 23 24 import swingwt.awt.Graphics; 25 import swingwt.awt.Dimension; 26 27 31 public abstract class ComponentUI 32 { 33 39 public static ComponentUI createUI(JComponent component) 40 { 41 throw new UnsupportedOperationException ( 42 "createUI(JComponent) must be implemented by final ComponentUI implementation!"); 43 } 44 45 public void installUI(JComponent c) {} 47 public void uninstallUI(JComponent c) {} 48 49 public void paint(Graphics g, JComponent c) {} 50 public void update(Graphics g, JComponent c) 51 { 52 if (c.isOpaque()) 53 { 54 g.setColor(c.getBackground()); 55 g.fillRect(0, 0, c.getWidth(), c.getHeight()); 56 } 57 paint(g, c); 58 } 59 60 61 public Dimension getPreferredSize(JComponent component) { return null; } 62 public Dimension getMinimumSize(JComponent component) { return getPreferredSize(component); } 63 public Dimension getMaximumSize(JComponent component) { return getPreferredSize(component); } 64 65 73 public boolean contains(JComponent component, int x, int y) { return false; } 76 77 78 public int getAccessibleChildrenCount(JComponent c) { return SwingUtilities.getAccessibleChildrenCount(c); } 79 public Accessible getAccessibleChild(JComponent c, int i) { return SwingUtilities.getAccessibleChild(c, i); } 80 } 81 | Popular Tags |