diff options
author | Mark Wielaard <mark@gcc.gnu.org> | 2006-03-10 21:46:48 +0000 |
---|---|---|
committer | Mark Wielaard <mark@gcc.gnu.org> | 2006-03-10 21:46:48 +0000 |
commit | 8aa540d2f783474d1d2e06f16744bf67b9c1facc (patch) | |
tree | ea38c56431c5d4528fb54254c3f8e50f517bede3 /libjava/classpath/java/awt/peer | |
parent | 27079765d00123f8e53d0e1ef7f9d46559266e6d (diff) | |
download | gcc-8aa540d2f783474d1d2e06f16744bf67b9c1facc.zip gcc-8aa540d2f783474d1d2e06f16744bf67b9c1facc.tar.gz gcc-8aa540d2f783474d1d2e06f16744bf67b9c1facc.tar.bz2 |
Imported GNU Classpath 0.90
Imported GNU Classpath 0.90
* scripts/makemake.tcl: Set gnu/java/awt/peer/swing to ignore.
* gnu/classpath/jdwp/VMFrame.java (SIZE): New constant.
* java/lang/VMCompiler.java: Use gnu.java.security.hash.MD5.
* java/lang/Math.java: New override file.
* java/lang/Character.java: Merged from Classpath.
(start, end): Now 'int's.
(canonicalName): New field.
(CANONICAL_NAME, NO_SPACES_NAME, CONSTANT_NAME): New constants.
(UnicodeBlock): Added argument.
(of): New overload.
(forName): New method.
Updated unicode blocks.
(sets): Updated.
* sources.am: Regenerated.
* Makefile.in: Likewise.
From-SVN: r111942
Diffstat (limited to 'libjava/classpath/java/awt/peer')
-rw-r--r-- | libjava/classpath/java/awt/peer/ComponentPeer.java | 284 |
1 files changed, 276 insertions, 8 deletions
diff --git a/libjava/classpath/java/awt/peer/ComponentPeer.java b/libjava/classpath/java/awt/peer/ComponentPeer.java index 1ba1692..97b96f4 100644 --- a/libjava/classpath/java/awt/peer/ComponentPeer.java +++ b/libjava/classpath/java/awt/peer/ComponentPeer.java @@ -59,76 +59,344 @@ import java.awt.image.ImageObserver; import java.awt.image.ImageProducer; import java.awt.image.VolatileImage; +/** + * Defines the methods that a component peer is required to implement. + */ public interface ComponentPeer { + /** + * Returns the construction status of the specified image. This is called + * by {@link Component#checkImage(Image, int, int, ImageObserver)}. + * + * @param img the image + * @param width the width of the image + * @param height the height of the image + * @param ob the image observer to be notified of updates of the status + * + * @return a bitwise ORed set of ImageObserver flags + */ int checkImage(Image img, int width, int height, - ImageObserver ob); + ImageObserver ob); + + /** + * Creates an image by starting the specified image producer. This is called + * by {@link Component#createImage(ImageProducer)}. + * + * @param prod the image producer to be used to create the image + * + * @return the created image + */ Image createImage(ImageProducer prod); + + /** + * Creates an empty image with the specified <code>width</code> and + * <code>height</code>. + * + * @param width the width of the image to be created + * @param height the height of the image to be created + * + * @return the created image + */ Image createImage(int width, int height); + + /** + * Disables the component. This is called by {@link Component#disable()}. + */ void disable(); + + /** + * Disposes the component peer. This should release all resources held by the + * peer. This is called when the component is no longer in use. + */ void dispose(); + + /** + * Enables the component. This is called by {@link Component#enable()}. + */ void enable(); + + /** + * Returns the color model of the component. This is currently not used. + * + * @return the color model of the component + */ ColorModel getColorModel(); + + /** + * Returns the font metrics for the specified font. This is called by + * {@link Component#getFontMetrics(Font)}. + * + * @param f the font for which to query the font metrics + * + * @return the font metrics for the specified font + */ FontMetrics getFontMetrics(Font f); + + /** + * Returns a {@link Graphics} object suitable for drawing on this component. + * This is called by {@link Component#getGraphics()}. + * + * @return a graphics object suitable for drawing on this component + */ Graphics getGraphics(); + + /** + * Returns the location of this component in screen coordinates. This is + * called by {@link Component#getLocationOnScreen()}. + * + * @return the location of this component in screen coordinates + */ Point getLocationOnScreen(); + + /** + * Returns the minimum size for the component. This is called by + * {@link Component#getMinimumSize()}. + * + * @return the minimum size for the component + */ Dimension getMinimumSize(); + + /** + * Returns the preferred size for the component. This is called by + * {@link Component#getPreferredSize()}. + * + * @return the preferred size for the component + */ Dimension getPreferredSize(); + + /** + * Returns the toolkit that created this peer. + * + * @return the toolkit that created this peer + */ Toolkit getToolkit(); + + /** + * Handles the given event. This is called from + * {@link Component#dispatchEvent(AWTEvent)} to give the peer a chance to + * react to events for the component. + * + * @param e the event + */ void handleEvent(AWTEvent e); + + /** + * Makes the component invisible. This is called from + * {@link Component#hide()}. + */ void hide(); /** - * Part of the earlier 1.1 API, replaced by isFocusable(). + * Returns <code>true</code> if the component can receive keyboard input + * focus. This is called from {@link Component#isFocusTraversable()}. + * + * @specnote Part of the earlier 1.1 API, replaced by isFocusable(). */ boolean isFocusTraversable(); + + /** + * Returns <code>true</code> if the component can receive keyboard input + * focus. This is called from {@link Component#isFocusable()}. + */ boolean isFocusable(); + + /** + * Returns the minimum size for the component. This is called by + * {@link Component#minimumSize()}. + * + * @return the minimum size for the component + */ Dimension minimumSize(); + + /** + * Returns the preferred size for the component. This is called by + * {@link Component#getPreferredSize()}. + * + * @return the preferred size for the component + */ Dimension preferredSize(); + void paint(Graphics graphics); + + /** + * Prepares an image for rendering on this component. This is called by + * {@link Component#prepareImage(Image, int, int, ImageObserver)}. + * + * @param img the image to prepare + * @param width the desired width of the rendered image + * @param height the desired height of the rendered image + * @param ob the image observer to be notified of updates in the preparation + * process + * + * @return <code>true</code> if the image has been fully prepared, + * <code>false</code> otherwise (in which case the image observer + * receives updates) + */ boolean prepareImage(Image img, int width, int height, ImageObserver ob); + void print(Graphics graphics); + + /** + * Repaints the specified rectangle of this component. This is called from + * {@link Component#repaint(long, int, int, int, int)}. + * + * @param tm number of milliseconds to wait with repainting + * @param x the X coordinate of the upper left corner of the damaged rectangle + * @param y the Y coordinate of the upper left corner of the damaged rectangle + * @param width the width of the damaged rectangle + * @param height the height of the damaged rectangle + */ void repaint(long tm, int x, int y, int width, int height); /** - * Part of the earlier 1.1 API, apparently replaced by argument - * form of the same method. + * Requests that this component receives the focus. This is called from + * {@link Component#requestFocus()}. + * + * @specnote Part of the earlier 1.1 API, apparently replaced by argument + * form of the same method. */ void requestFocus(); - boolean requestFocus (Component source, boolean bool1, boolean bool2, long x); + /** + * Requests that this component receives the focus. This is called from + * {@link Component#requestFocus()}. + * + * @param source TODO + * @param bool1 TODO + * @param bool2 TODO + * @param x TODO + */ + boolean requestFocus(Component source, boolean bool1, boolean bool2, long x); + + /** + * Notifies the peer that the bounds of this component have changed. This + * is called by {@link Component#reshape(int, int, int, int)}. + * + * @param x the X coordinate of the upper left corner of the component + * @param y the Y coordinate of the upper left corner of the component + * @param width the width of the component + * @param height the height of the component + */ void reshape(int x, int y, int width, int height); + + /** + * Sets the background color of the component. This is called by + * {@link Component#setBackground(Color)}. + * + * @param color the background color to set + */ void setBackground(Color color); + + /** + * Notifies the peer that the bounds of this component have changed. This + * is called by {@link Component#setBounds(int, int, int, int)}. + * + * @param x the X coordinate of the upper left corner of the component + * @param y the Y coordinate of the upper left corner of the component + * @param width the width of the component + * @param height the height of the component + */ void setBounds(int x, int y, int width, int height); /** - * Part of the earlier 1.1 API, apparently no longer needed. + * Sets the cursor of the component. This is called by + * {@link Component#setCursor(Cursor)}. + * + * @specnote Part of the earlier 1.1 API, apparently no longer needed. */ void setCursor(Cursor cursor); + /** + * Sets the enabled/disabled state of this component. This is called by + * {@link Component#setEnabled(boolean)}. + * + * @param enabled <code>true</code> to enable the component, + * <code>false</code> to disable it + */ void setEnabled(boolean enabled); + + /** + * Sets the font of the component. This is called by + * {@link Component#setFont(Font)}. + * + * @param font the font to set + */ void setFont(Font font); + + /** + * Sets the foreground color of the component. This is called by + * {@link Component#setForeground(Color)}. + * + * @param color the foreground color to set + */ void setForeground(Color color); + + /** + * Sets the visibility state of the component. This is called by + * {@link Component#setVisible(boolean)}. + * + * @param visible <code>true</code> to make the component visible, + * <code>false</code> to make it invisible + */ void setVisible(boolean visible); + + /** + * Makes the component visible. This is called by {@link Component#show()}. + */ void show(); /** * Get the graphics configuration of the component. The color model * of the component can be derived from the configuration. + * + * @return the graphics configuration of the component */ GraphicsConfiguration getGraphicsConfiguration(); /** * Part of an older API, no longer needed. */ - void setEventMask (long mask); + void setEventMask(long mask); - // Methods below are introduced since 1.1 + /** + * Returns <code>true</code> if this component has been obscured, + * <code>false</code> otherwise. This will only work if + * {@link #canDetermineObscurity()} also returns <code>true</code>. + * + * @return <code>true</code> if this component has been obscured, + * <code>false</code> otherwise. + */ boolean isObscured(); + + /** + * Returns <code>true</code> if this component peer can determine if the + * component has been obscured, <code>false</code> otherwise. + * + * @return <code>true</code> if this component peer can determine if the + * component has been obscured, <code>false</code> otherwise + */ boolean canDetermineObscurity(); + + /** + * Coalesces the specified paint event. + * + * @param e the paint event + */ void coalescePaintEvent(PaintEvent e); + + /** + * Updates the cursor. + */ void updateCursorImmediately(); + + /** + * Returns true, if this component can handle wheel scrolling, + * <code>false</code> otherwise. + * + * @return true, if this component can handle wheel scrolling, + * <code>false</code> otherwise + */ boolean handlesWheelScrolling(); /** |