5 |
import javax.swing.*; |
import javax.swing.*; |
6 |
|
|
7 |
|
|
8 |
public abstract class ComponentUI |
public abstract class ComponentUI |
9 |
|
implements UIResource // ?? |
10 |
{ |
{ |
11 |
boolean contains(JComponent c, int x, int y) |
boolean contains(JComponent c, int x, int y) |
12 |
{ |
{ |
14 |
} |
} |
15 |
|
|
16 |
// this SHOULD thow an error: |
// this SHOULD thow an error: |
17 |
static ComponentUI createUI(JComponent c) |
public static ComponentUI createUI(JComponent c) |
18 |
{ |
{ |
19 |
Exception e = new Exception("createUI from ComponentUI should never be called"); |
Exception e = new Exception("createUI from ComponentUI should never be called"); |
20 |
e.printStackTrace(); |
e.printStackTrace(); |
22 |
return null; |
return null; |
23 |
} |
} |
24 |
|
|
25 |
Accessible getAccessibleChild(JComponent c, int i) |
public Accessible getAccessibleChild(JComponent c, int i) |
26 |
{ |
{ |
27 |
//Return the nth Accessible child of the object. |
//Return the nth Accessible child of the object. |
28 |
return null; |
return null; |
29 |
} |
} |
30 |
|
|
31 |
int getAccessibleChildrenCount(JComponent c) |
public int getAccessibleChildrenCount(JComponent c) |
32 |
{ |
{ |
33 |
//Returns the number of accessible children in the object. |
//Returns the number of accessible children in the object. |
34 |
return 0; |
return 0; |
35 |
} |
} |
36 |
|
|
37 |
Dimension getMaximumSize(JComponent c) |
public Dimension getMaximumSize(JComponent c) |
38 |
{ |
{ |
39 |
return getPreferredSize(c); |
return getPreferredSize(c); |
40 |
} |
} |
41 |
|
|
42 |
Dimension getMinimumSize(JComponent c) |
public Dimension getMinimumSize(JComponent c) |
43 |
{ |
{ |
44 |
return getPreferredSize(c); |
return getPreferredSize(c); |
45 |
} |
} |
46 |
|
|
47 |
Dimension getPreferredSize(JComponent c) |
public Dimension getPreferredSize(JComponent c) |
48 |
{ |
{ |
49 |
return null; |
return null; |
50 |
} |
} |
51 |
|
|
52 |
void installUI(JComponent c) |
public void installUI(JComponent c) |
53 |
{ |
{ |
54 |
String id = c.getUIClassID() + ".border"; |
String id = c.getUIClassID() + ".border"; |
55 |
|
|
66 |
} |
} |
67 |
} |
} |
68 |
|
|
69 |
void paint(Graphics g, JComponent c) |
public void paint(Graphics g, JComponent c) |
70 |
{ |
{ |
71 |
// System.out.println("UI-COMPONENT-> unimplemented paint: " + c + ", UI="+this); |
// System.out.println("UI-COMPONENT-> unimplemented paint: " + c + ", UI="+this); |
72 |
} |
} |
73 |
|
|
74 |
void uninstallUI(JComponent c) |
public void uninstallUI(JComponent c) |
75 |
{ |
{ |
76 |
} |
} |
77 |
|
|
78 |
void update(Graphics g, JComponent c) { |
public void update(Graphics g, JComponent c) { |
79 |
if (c.isOpaque()) { |
if (c.isOpaque()) { |
80 |
g.setColor(c.getBackground()); |
g.setColor(c.getBackground()); |
81 |
g.fillRect(0, 0, c.getWidth(),c.getHeight()); |
g.fillRect(0, 0, c.getWidth(),c.getHeight()); |