source: trunk/gcc/libjava/javax/swing/plaf/ComponentUI.java

Last change on this file was 1389, checked in by bird, 21 years ago

Initial revision

  • Property cvs2svn:cvs-rev set to 1.1
  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 1.8 KB
Line 
1package javax.swing.plaf;
2
3import java.awt.*;
4import javax.swing.border.*;
5import javax.swing.*;
6
7import javax.accessibility.*;
8
9public abstract class ComponentUI
10 implements UIResource // ??
11{
12 boolean contains(JComponent c, int x, int y)
13 {
14 return c.inside(x,y);
15 }
16
17 // this SHOULD thow an error:
18 public static ComponentUI createUI(JComponent c)
19 {
20 Exception e = new Exception("createUI from ComponentUI should never be called");
21 e.printStackTrace();
22 System.exit(1);
23 return null;
24 }
25
26 public Accessible getAccessibleChild(JComponent c, int i)
27 {
28 //Return the nth Accessible child of the object.
29 return null;
30 }
31
32 public int getAccessibleChildrenCount(JComponent c)
33 {
34 //Returns the number of accessible children in the object.
35 return 0;
36 }
37
38 public Dimension getMaximumSize(JComponent c)
39 {
40 return getPreferredSize(c);
41 }
42
43 public Dimension getMinimumSize(JComponent c)
44 {
45 return getPreferredSize(c);
46 }
47
48 public Dimension getPreferredSize(JComponent c)
49 {
50 return null;
51 }
52
53 public void installUI(JComponent c)
54 {
55 String id = c.getUIClassID() + ".border";
56
57 Border s = UIManager.getBorder( id );
58
59 if (s != null)
60 {
61 c.setBorder( s );
62 //System.out.println("OK-INSTALL: " + this + ", ID=" + id + ",B="+s);
63 }
64 else
65 {
66 ///System.out.println("FAIL-INSTALL: " + this + ", " + id);
67 }
68 }
69
70 public void paint(Graphics g, JComponent c)
71 {
72 // System.out.println("UI-COMPONENT-> unimplemented paint: " + c + ", UI="+this);
73 }
74
75 public void uninstallUI(JComponent c)
76 {
77 }
78
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());
83 }
84 paint(g, c);
85 }
86
87}
88
Note: See TracBrowser for help on using the repository browser.