aboutsummaryrefslogtreecommitdiff
path: root/libjava/javax/swing/plaf/ComponentUI.java
blob: cdccbabbe48e4fc9c5a6ecb55fe4bb1b72a3ac4d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
package javax.swing.plaf;

import java.awt.*;
import javax.swing.border.*;
import javax.swing.*;

import javax.accessibility.*;

public abstract class ComponentUI 
    implements UIResource // ??
{
    boolean contains(JComponent c, int x, int y)
    {
	return c.inside(x,y);
    }

    // this SHOULD thow an error:
    public static ComponentUI createUI(JComponent c)
    {
	Exception e = new Exception("createUI from ComponentUI should never be called");
	e.printStackTrace();
	System.exit(1);
	return null;
    }

    public Accessible getAccessibleChild(JComponent c, int i)
    {
	//Return the nth Accessible child of the object. 
	return null;
    }
  
    public int getAccessibleChildrenCount(JComponent c)
    {
	//Returns the number of accessible children in the object. 
	return 0;
    }
  
    public Dimension getMaximumSize(JComponent c)
    {
	return getPreferredSize(c);
    }

    public Dimension getMinimumSize(JComponent c)
    {
	return getPreferredSize(c);
    }

    public Dimension getPreferredSize(JComponent c)
    {
	return null;
    }

    public void installUI(JComponent c)
    {
	String id = c.getUIClassID() + ".border";

	Border s = UIManager.getBorder( id );
	
	if (s != null)
	    {
		c.setBorder( s );
		//System.out.println("OK-INSTALL: " + this + ", ID=" + id + ",B="+s);
	    }
	else
	    {
		///System.out.println("FAIL-INSTALL: " + this + ", " + id);
	    }	
    }

    public void paint(Graphics g, JComponent c)
    {
	//  System.out.println("UI-COMPONENT-> unimplemented paint: " + c + ", UI="+this);
    }

    public void uninstallUI(JComponent c)
    {	
    }

    public void update(Graphics g, JComponent c) {
        if (c.isOpaque()) {
            g.setColor(c.getBackground());
            g.fillRect(0, 0, c.getWidth(),c.getHeight());
        }
        paint(g, c);
    }
         
}