KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > java > awt > peer > ComponentPeer


1 /*
2  * @(#)ComponentPeer.java 1.48 04/06/08
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package java.awt.peer;
9
10 import java.awt.*;
11 import java.awt.event.PaintEvent JavaDoc;
12 import java.awt.image.ImageProducer JavaDoc;
13 import java.awt.image.ImageObserver JavaDoc;
14 import java.awt.image.ColorModel JavaDoc;
15 import java.awt.image.VolatileImage JavaDoc;
16 import java.awt.GraphicsConfiguration JavaDoc;
17
18 import java.awt.dnd.peer.DropTargetPeer;
19
20 /**
21  * The peer interfaces are intended only for use in porting
22  * the AWT. They are not intended for use by application
23  * developers, and developers should not implement peers
24  * nor invoke any of the peer methods directly on the peer
25  * instances.
26  */

27 public interface ComponentPeer {
28     public static final int SET_LOCATION = 1,
29         SET_SIZE = 2,
30         SET_BOUNDS = 3,
31         SET_CLIENT_SIZE = 4,
32         RESET_OPERATION = 5,
33         NO_EMBEDDED_CHECK = (1 << 14),
34         DEFAULT_OPERATION = SET_BOUNDS;
35     boolean isObscured();
36     boolean canDetermineObscurity();
37     void setVisible(boolean b);
38     void setEnabled(boolean b);
39     void paint(Graphics g);
40     void repaint(long tm, int x, int y, int width, int height);
41     void print(Graphics g);
42     void setBounds(int x, int y, int width, int height, int op);
43     void handleEvent(AWTEvent e);
44     void coalescePaintEvent(PaintEvent JavaDoc e);
45     Point getLocationOnScreen();
46     Dimension getPreferredSize();
47     Dimension getMinimumSize();
48     ColorModel JavaDoc getColorModel();
49     Toolkit getToolkit();
50     Graphics getGraphics();
51     FontMetrics getFontMetrics(Font font);
52     void dispose();
53     void setForeground(Color c);
54     void setBackground(Color c);
55     void setFont(Font f);
56     void updateCursorImmediately();
57     boolean requestFocus(Component lightweightChild,
58                                      boolean temporary,
59                      boolean focusedWindowChangeAllowed,
60                                      long time);
61     boolean isFocusable();
62
63     Image JavaDoc createImage(ImageProducer JavaDoc producer);
64     Image JavaDoc createImage(int width, int height);
65     VolatileImage JavaDoc createVolatileImage(int width, int height);
66     boolean prepareImage(Image JavaDoc img, int w, int h, ImageObserver JavaDoc o);
67     int checkImage(Image JavaDoc img, int w, int h, ImageObserver JavaDoc o);
68     GraphicsConfiguration JavaDoc getGraphicsConfiguration();
69     boolean handlesWheelScrolling();
70     void createBuffers(int numBuffers, BufferCapabilities caps) throws AWTException;
71     Image JavaDoc getBackBuffer();
72     void flip(BufferCapabilities.FlipContents flipAction);
73     void destroyBuffers();
74
75     /**
76      * Reparents this peer to the new parent referenced by <code>newContainer</code> peer
77      * Implementation depends on toolkit and container.
78      * @param newContainer peer of the new parent container
79      * @since 1.5
80      */

81     void reparent(ContainerPeer newContainer);
82     /**
83      * Returns whether this peer supports reparenting to another parent withour destroying the peer
84      * @return true if appropriate reparent is supported, false otherwise
85      * @since 1.5
86      */

87     boolean isReparentSupported();
88
89     /**
90      * Used by lightweight implementations to tell a ComponentPeer to layout
91      * its sub-elements. For instance, a lightweight Checkbox needs to layout
92      * the box, as well as the text label.
93      */

94     void layout();
95
96
97         Rectangle getBounds();
98
99     /**
100      * DEPRECATED: Replaced by getPreferredSize().
101      */

102     Dimension preferredSize();
103
104     /**
105      * DEPRECATED: Replaced by getMinimumSize().
106      */

107     Dimension minimumSize();
108
109     /**
110      * DEPRECATED: Replaced by setVisible(boolean).
111      */

112     void show();
113
114     /**
115      * DEPRECATED: Replaced by setVisible(boolean).
116      */

117     void hide();
118
119     /**
120      * DEPRECATED: Replaced by setEnabled(boolean).
121      */

122     void enable();
123
124     /**
125      * DEPRECATED: Replaced by setEnabled(boolean).
126      */

127     void disable();
128
129     /**
130      * DEPRECATED: Replaced by setBounds(int, int, int, int).
131      */

132     void reshape(int x, int y, int width, int height);
133 }
134
Popular Tags