1 7 8 package javax.swing.plaf; 9 10 import javax.swing.JComponent ; 11 import javax.swing.SwingUtilities ; 12 import javax.accessibility.Accessible ; 13 14 import java.awt.Container ; 15 import java.awt.Dimension ; 16 import java.awt.Graphics ; 17 import java.awt.Insets ; 18 19 20 35 public abstract class ComponentUI { 36 40 public ComponentUI() { 41 } 42 43 68 public void installUI(JComponent c) { 69 } 70 71 96 public void uninstallUI(JComponent c) { 97 } 98 99 114 public void paint(Graphics g, JComponent c) { 115 } 116 117 137 public void update(Graphics g, JComponent c) { 138 if (c.isOpaque()) { 139 g.setColor(c.getBackground()); 140 g.fillRect(0, 0, c.getWidth(),c.getHeight()); 141 } 142 paint(g, c); 143 } 144 145 161 public Dimension getPreferredSize(JComponent c) { 162 return null; 163 } 164 165 184 public Dimension getMinimumSize(JComponent c) { 185 return getPreferredSize(c); 186 } 187 188 205 public Dimension getMaximumSize(JComponent c) { 206 return getPreferredSize(c); 207 } 208 209 228 public boolean contains(JComponent c, int x, int y) { 229 return c.inside(x, y); 230 } 231 232 242 public static ComponentUI createUI(JComponent c) { 243 throw new Error ("ComponentUI.createUI not implemented."); 244 } 245 246 262 public int getAccessibleChildrenCount(JComponent c) { 263 return SwingUtilities.getAccessibleChildrenCount(c); 264 } 265 266 282 public Accessible getAccessibleChild(JComponent c, int i) { 283 return SwingUtilities.getAccessibleChild(c, i); 284 } 285 } 286 287 | Popular Tags |