| 1 | package javax.swing.plaf;
|
|---|
| 2 |
|
|---|
| 3 | import java.awt.*;
|
|---|
| 4 | import javax.swing.border.*;
|
|---|
| 5 | import javax.swing.*;
|
|---|
| 6 |
|
|---|
| 7 | import javax.accessibility.*;
|
|---|
| 8 |
|
|---|
| 9 | public 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 |
|
|---|