src/share/classes/java/awt/Component.java
Print this page
*** 1073,1082 ****
--- 1073,1083 ----
/**
* @deprecated As of JDK version 1.1,
* programs should not directly manipulate peers;
* replaced by <code>boolean isDisplayable()</code>.
+ * @return the peer for this component
*/
@Deprecated
public ComponentPeer getPeer() {
return peer;
}
*** 1130,1139 ****
--- 1131,1142 ----
}
/**
* Gets the <code>DropTarget</code> associated with this
* <code>Component</code>.
+ *
+ * @return the drop target
*/
public synchronized DropTarget getDropTarget() { return dropTarget; }
/**
*** 1496,1505 ****
--- 1499,1513 ----
}
}
}
/**
+ * Enables or disables this component.
+ *
+ * @param b {@code true} to enable this component;
+ * otherwise {@code false}
+ *
* @deprecated As of JDK version 1.1,
* replaced by <code>setEnabled(boolean)</code>.
*/
@Deprecated
public void enable(boolean b) {
*** 1654,1663 ****
--- 1662,1676 ----
}
}
}
/**
+ * Makes this component visible or invisible.
+ *
+ * @param b {@code true} to make this component visible;
+ * otherwise {@code false}
+ *
* @deprecated As of JDK version 1.1,
* replaced by <code>setVisible(boolean)</code>.
*/
@Deprecated
public void show(boolean b) {
*** 2066,2075 ****
--- 2079,2091 ----
}
}
/**
+ * Returns the location of this component's top left corner.
+ *
+ * @return the location of this component's top left corner
* @deprecated As of JDK version 1.1,
* replaced by <code>getLocation()</code>.
*/
@Deprecated
public Point location() {
*** 2100,2109 ****
--- 2116,2132 ----
public void setLocation(int x, int y) {
move(x, y);
}
/**
+ * Moves this component to a new location.
+ *
+ * @param x the <i>x</i>-coordinate of the new location's
+ * top-left corner in the parent's coordinate space
+ * @param y the <i>y</i>-coordinate of the new location's
+ * top-left corner in the parent's coordinate space
+ *
* @deprecated As of JDK version 1.1,
* replaced by <code>setLocation(int, int)</code>.
*/
@Deprecated
public void move(int x, int y) {
*** 2148,2157 ****
--- 2171,2185 ----
public Dimension getSize() {
return size();
}
/**
+ * Returns the size of this component in the form of a
+ * {@code Dimension} object.
+ *
+ * @return the {@code Dimension} object that indicates the
+ * size of this component
* @deprecated As of JDK version 1.1,
* replaced by <code>getSize()</code>.
*/
@Deprecated
public Dimension size() {
*** 2175,2184 ****
--- 2203,2216 ----
public void setSize(int width, int height) {
resize(width, height);
}
/**
+ * Resizes this component.
+ *
+ * @param width the new width of the component
+ * @param height the new height of the component
* @deprecated As of JDK version 1.1,
* replaced by <code>setSize(int, int)</code>.
*/
@Deprecated
public void resize(int width, int height) {
*** 2206,2215 ****
--- 2238,2251 ----
public void setSize(Dimension d) {
resize(d);
}
/**
+ * Resizes this component so that it has width {@code d.width}
+ * and height {@code d.height}.
+ *
+ * @param d the new size of this component
* @deprecated As of JDK version 1.1,
* replaced by <code>setSize(Dimension)</code>.
*/
@Deprecated
public void resize(Dimension d) {
*** 2229,2238 ****
--- 2265,2277 ----
public Rectangle getBounds() {
return bounds();
}
/**
+ * Returns the bounding rectangle of this component.
+ *
+ * @return the bounding rectangle for this component
* @deprecated As of JDK version 1.1,
* replaced by <code>getBounds()</code>.
*/
@Deprecated
public Rectangle bounds() {
*** 2263,2272 ****
--- 2302,2318 ----
public void setBounds(int x, int y, int width, int height) {
reshape(x, y, width, height);
}
/**
+ * Reshapes the bounding rectangle for this component.
+ *
+ * @param x the <i>x</i> coordinate of the upper left corner of the rectangle
+ * @param y the <i>y</i> coordinate of the upper left corner of the rectangle
+ * @param width the width of the rectangle
+ * @param height the height of the rectangle
+ *
* @deprecated As of JDK version 1.1,
* replaced by <code>setBounds(int, int, int, int)</code>.
*/
@Deprecated
public void reshape(int x, int y, int width, int height) {
*** 2629,2638 ****
--- 2675,2687 ----
return preferredSize();
}
/**
+ * Returns the component's preferred size.
+ *
+ * @return the component's preferred size
* @deprecated As of JDK version 1.1,
* replaced by <code>getPreferredSize()</code>.
*/
@Deprecated
public Dimension preferredSize() {
*** 2699,2708 ****
--- 2748,2760 ----
public Dimension getMinimumSize() {
return minimumSize();
}
/**
+ * Returns the minimum size of this component.
+ *
+ * @return the minimum size of this component
* @deprecated As of JDK version 1.1,
* replaced by <code>getMinimumSize()</code>.
*/
@Deprecated
public Dimension minimumSize() {
*** 2779,2788 ****
--- 2831,2842 ----
* Returns the alignment along the x axis. This specifies how
* the component would like to be aligned relative to other
* components. The value should be a number between 0 and 1
* where 0 represents alignment along the origin, 1 is aligned
* the furthest away from the origin, 0.5 is centered, etc.
+ *
+ * @return the horizontal alignment of this component
*/
public float getAlignmentX() {
return CENTER_ALIGNMENT;
}
*** 2790,2799 ****
--- 2844,2855 ----
* Returns the alignment along the y axis. This specifies how
* the component would like to be aligned relative to other
* components. The value should be a number between 0 and 1
* where 0 represents alignment along the origin, 1 is aligned
* the furthest away from the origin, 0.5 is centered, etc.
+ *
+ * @return the vertical alignment of this component
*/
public float getAlignmentY() {
return CENTER_ALIGNMENT;
}
*** 3155,3164 ****
--- 3211,3222 ----
/**
* Gets the cursor set in the component. If the component does
* not have a cursor set, the cursor of its parent is returned.
* If no cursor is set in the entire hierarchy,
* <code>Cursor.DEFAULT_CURSOR</code> is returned.
+ *
+ * @return the cursor for this component
* @see #setCursor
* @since JDK1.1
*/
public Cursor getCursor() {
return getCursor_NoClientCode();
*** 4258,4271 ****
/**
* Whether or not the drawing buffer has been recently restored from
* a lost state.
*/
protected boolean validatedContents; // = false
/**
! * Size of the back buffers
*/
protected int width;
protected int height;
/**
* Insets for the hosting Component. The size of the back buffer
* is constrained by these.
--- 4316,4334 ----
/**
* Whether or not the drawing buffer has been recently restored from
* a lost state.
*/
protected boolean validatedContents; // = false
+
/**
! * The width of the back buffers
*/
protected int width;
+
+ /**
+ * The height of the back buffers
+ */
protected int height;
/**
* Insets for the hosting Component. The size of the back buffer
* is constrained by these.
*** 4302,4311 ****
--- 4365,4376 ----
}
}
/**
* Creates the back buffers
+ *
+ * @param numBuffers the number of buffers to create
*/
protected void createBackBuffers(int numBuffers) {
if (numBuffers == 0) {
backBuffers = null;
} else {
*** 4591,4600 ****
--- 4656,4668 ----
* <p>
* This is useful, for example, if running under full-screen mode and
* better performance is desired, or if page-flipping is used as the
* buffer strategy.
*
+ * @param ignoreRepaint {@code true} if the paint messages from the OS
+ * should be ignored; otherwise {@code false}
+ *
* @since 1.4
* @see #getIgnoreRepaint
* @see Canvas#createBufferStrategy
* @see Window#createBufferStrategy
* @see java.awt.image.BufferStrategy
*** 4617,4636 ****
--- 4685,4713 ----
/**
* Checks whether this component "contains" the specified point,
* where <code>x</code> and <code>y</code> are defined to be
* relative to the coordinate system of this component.
+ *
* @param x the <i>x</i> coordinate of the point
* @param y the <i>y</i> coordinate of the point
+ * @return {@code true} if the point is within the component;
+ * otherwise {@code false}
* @see #getComponentAt(int, int)
* @since JDK1.1
*/
public boolean contains(int x, int y) {
return inside(x, y);
}
/**
+ * Checks whether the point is inside of this component.
+ *
+ * @param x the <i>x</i> coordinate of the point
+ * @param y the <i>y</i> coordinate of the point
+ * @return {@code true} if the point is within the component;
+ * otherwise {@code false}
* @deprecated As of JDK version 1.1,
* replaced by contains(int, int).
*/
@Deprecated
public boolean inside(int x, int y) {
*** 4639,4649 ****
--- 4716,4729 ----
/**
* Checks whether this component "contains" the specified point,
* where the point's <i>x</i> and <i>y</i> coordinates are defined
* to be relative to the coordinate system of this component.
+ *
* @param p the point
+ * @return {@code true} if the point is within the component;
+ * otherwise {@code false}
* @throws NullPointerException if {@code p} is {@code null}
* @see #getComponentAt(Point)
* @since JDK1.1
*/
public boolean contains(Point p) {
*** 4674,4683 ****
--- 4754,4770 ----
public Component getComponentAt(int x, int y) {
return locate(x, y);
}
/**
+ * Returns the component occupying the position specified (this component,
+ * or immediate child component, or null if neither
+ * of the first two occupies the location).
+ *
+ * @param x the <i>x</i> coordinate to search for components at
+ * @param y the <i>y</i> coordinate to search for components at
+ * @return the component at the specified location or {@code null}
* @deprecated As of JDK version 1.1,
* replaced by getComponentAt(int, int).
*/
@Deprecated
public Component locate(int x, int y) {
*** 4686,4703 ****
--- 4773,4792 ----
/**
* Returns the component or subcomponent that contains the
* specified point.
* @param p the point
+ * @return the component at the specified location or {@code null}
* @see java.awt.Component#contains
* @since JDK1.1
*/
public Component getComponentAt(Point p) {
return getComponentAt(p.x, p.y);
}
/**
+ * @param e the event to deliver
* @deprecated As of JDK version 1.1,
* replaced by <code>dispatchEvent(AWTEvent e)</code>.
*/
@Deprecated
public void deliverEvent(Event e) {
*** 6744,6753 ****
--- 6833,6844 ----
}
}
}
/**
+ * @param evt the event to handle
+ * @return {@code true} if the event was handled, {@code false} otherwise
* @deprecated As of JDK version 1.1
* replaced by processEvent(AWTEvent).
*/
@Deprecated
public boolean handleEvent(Event evt) {
*** 6787,6868 ****
--- 6878,6992 ----
}
return false;
}
/**
+ * @param evt the event to handle
+ * @param x the x coordinate
+ * @param y the y coordinate
+ * @return {@code false}
* @deprecated As of JDK version 1.1,
* replaced by processMouseEvent(MouseEvent).
*/
@Deprecated
public boolean mouseDown(Event evt, int x, int y) {
return false;
}
/**
+ * @param evt the event to handle
+ * @param x the x coordinate
+ * @param y the y coordinate
+ * @return {@code false}
* @deprecated As of JDK version 1.1,
* replaced by processMouseMotionEvent(MouseEvent).
*/
@Deprecated
public boolean mouseDrag(Event evt, int x, int y) {
return false;
}
/**
+ * @param evt the event to handle
+ * @param x the x coordinate
+ * @param y the y coordinate
+ * @return {@code false}
* @deprecated As of JDK version 1.1,
* replaced by processMouseEvent(MouseEvent).
*/
@Deprecated
public boolean mouseUp(Event evt, int x, int y) {
return false;
}
/**
+ * @param evt the event to handle
+ * @param x the x coordinate
+ * @param y the y coordinate
+ * @return {@code false}
* @deprecated As of JDK version 1.1,
* replaced by processMouseMotionEvent(MouseEvent).
*/
@Deprecated
public boolean mouseMove(Event evt, int x, int y) {
return false;
}
/**
+ * @param evt the event to handle
+ * @param x the x coordinate
+ * @param y the y coordinate
+ * @return {@code false}
* @deprecated As of JDK version 1.1,
* replaced by processMouseEvent(MouseEvent).
*/
@Deprecated
public boolean mouseEnter(Event evt, int x, int y) {
return false;
}
/**
+ * @param evt the event to handle
+ * @param x the x coordinate
+ * @param y the y coordinate
+ * @return {@code false}
* @deprecated As of JDK version 1.1,
* replaced by processMouseEvent(MouseEvent).
*/
@Deprecated
public boolean mouseExit(Event evt, int x, int y) {
return false;
}
/**
+ * @param evt the event to handle
+ * @param key the key pressed
+ * @return {@code false}
* @deprecated As of JDK version 1.1,
* replaced by processKeyEvent(KeyEvent).
*/
@Deprecated
public boolean keyDown(Event evt, int key) {
return false;
}
/**
+ * @param evt the event to handle
+ * @param key the key pressed
+ * @return {@code false}
* @deprecated As of JDK version 1.1,
* replaced by processKeyEvent(KeyEvent).
*/
@Deprecated
public boolean keyUp(Event evt, int key) {
return false;
}
/**
+ * @param evt the event to handle
+ * @param what the object acted on
+ * @return {@code false}
* @deprecated As of JDK version 1.1,
* should register this component as ActionListener on component
* which fires action events.
*/
@Deprecated
*** 7068,7086 ****
--- 7192,7216 ----
}
}
}
/**
+ * @param evt the event to handle
+ * @param what the object focused
+ * @return {@code false}
* @deprecated As of JDK version 1.1,
* replaced by processFocusEvent(FocusEvent).
*/
@Deprecated
public boolean gotFocus(Event evt, Object what) {
return false;
}
/**
+ * @param evt the event to handle
+ * @param what the object focused
+ * @return {@code false}
* @deprecated As of JDK version 1.1,
* replaced by processFocusEvent(FocusEvent).
*/
@Deprecated
public boolean lostFocus(Event evt, Object what) {
*** 8388,8409 ****
/**
* Returns an array of all the listeners which have been associated
* with the named property.
*
* @return all of the <code>PropertyChangeListener</code>s associated with
* the named property; if no such listeners have been added or
* if <code>propertyName</code> is <code>null</code>, an empty
* array is returned
*
* @see #addPropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener)
* @see #removePropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener)
* @see #getPropertyChangeListeners
* @since 1.4
*/
! public PropertyChangeListener[] getPropertyChangeListeners(
! String propertyName) {
synchronized (getObjectLock()) {
if (changeSupport == null) {
return new PropertyChangeListener[0];
}
return changeSupport.getPropertyChangeListeners(propertyName);
--- 8518,8540 ----
/**
* Returns an array of all the listeners which have been associated
* with the named property.
*
+ * @param propertyName the property name
+ *
* @return all of the <code>PropertyChangeListener</code>s associated with
* the named property; if no such listeners have been added or
* if <code>propertyName</code> is <code>null</code>, an empty
* array is returned
*
* @see #addPropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener)
* @see #removePropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener)
* @see #getPropertyChangeListeners
* @since 1.4
*/
! public PropertyChangeListener[] getPropertyChangeListeners(String propertyName) {
synchronized (getObjectLock()) {
if (changeSupport == null) {
return new PropertyChangeListener[0];
}
return changeSupport.getPropertyChangeListeners(propertyName);
*** 8877,8886 ****
--- 9008,9018 ----
* {@link #applyComponentOrientation applyComponentOrientation}.
* <p>
* This method changes layout-related information, and therefore,
* invalidates the component hierarchy.
*
+ * @param o the orientation to be set
*
* @see ComponentOrientation
* @see #invalidate
*
* @author Laura Werner, IBM
*** 8904,8913 ****
--- 9036,9046 ----
* the elements or text within this component. <code>LayoutManager</code>
* and <code>Component</code>
* subclasses that wish to respect orientation should call this method to
* get the component's orientation before performing layout or drawing.
*
+ * @return the orientation to order the elements or text
* @see ComponentOrientation
*
* @author Laura Werner, IBM
*/
public ComponentOrientation getComponentOrientation() {
*** 9061,9071 ****
--- 9194,9213 ----
* to add/remove ComponentListener and FocusListener to track
* target Component's state.
*/
private volatile transient int propertyListenersCount = 0;
+ /**
+ * A component listener to track show/hide/resize events
+ * and convert them to PropertyChange events.
+ */
protected ComponentListener accessibleAWTComponentHandler = null;
+
+ /**
+ * A listener to track focus events
+ * and convert them to PropertyChange events.
+ */
protected FocusListener accessibleAWTFocusHandler = null;
/**
* Fire PropertyChange listener, if one is registered,
* when shown/hidden..