FSF GCC merge 02/23/03
[official-gcc.git] / libjava / javax / swing / plaf / ComponentUI.java
blobcdccbabbe48e4fc9c5a6ecb55fe4bb1b72a3ac4d
1 package javax.swing.plaf;
3 import java.awt.*;
4 import javax.swing.border.*;
5 import javax.swing.*;
7 import javax.accessibility.*;
9 public abstract class ComponentUI
10 implements UIResource // ??
12 boolean contains(JComponent c, int x, int y)
14 return c.inside(x,y);
17 // this SHOULD thow an error:
18 public static ComponentUI createUI(JComponent c)
20 Exception e = new Exception("createUI from ComponentUI should never be called");
21 e.printStackTrace();
22 System.exit(1);
23 return null;
26 public Accessible getAccessibleChild(JComponent c, int i)
28 //Return the nth Accessible child of the object.
29 return null;
32 public int getAccessibleChildrenCount(JComponent c)
34 //Returns the number of accessible children in the object.
35 return 0;
38 public Dimension getMaximumSize(JComponent c)
40 return getPreferredSize(c);
43 public Dimension getMinimumSize(JComponent c)
45 return getPreferredSize(c);
48 public Dimension getPreferredSize(JComponent c)
50 return null;
53 public void installUI(JComponent c)
55 String id = c.getUIClassID() + ".border";
57 Border s = UIManager.getBorder( id );
59 if (s != null)
61 c.setBorder( s );
62 //System.out.println("OK-INSTALL: " + this + ", ID=" + id + ",B="+s);
64 else
66 ///System.out.println("FAIL-INSTALL: " + this + ", " + id);
70 public void paint(Graphics g, JComponent c)
72 // System.out.println("UI-COMPONENT-> unimplemented paint: " + c + ", UI="+this);
75 public void uninstallUI(JComponent c)
79 public void update(Graphics g, JComponent c) {
80 if (c.isOpaque()) {
81 g.setColor(c.getBackground());
82 g.fillRect(0, 0, c.getWidth(),c.getHeight());
84 paint(g, c);