src/share/classes/java/awt/Component.java

Print this page

        

@@ -1073,10 +1073,11 @@
 
     /**
      * @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,10 +1131,12 @@
     }
 
     /**
      * Gets the <code>DropTarget</code> associated with this
      * <code>Component</code>.
+     *
+     * @return the drop target
      */
 
     public synchronized DropTarget getDropTarget() { return dropTarget; }
 
     /**

@@ -1496,10 +1499,15 @@
             }
         }
     }
 
     /**
+     * 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,10 +1662,15 @@
             }
         }
     }
 
     /**
+     * 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,10 +2079,13 @@
         }
     }
 
 
     /**
+     * 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,10 +2116,17 @@
     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,10 +2171,15 @@
     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,10 +2203,14 @@
     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,10 +2238,14 @@
     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,10 +2265,13 @@
     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,10 +2302,17 @@
     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,10 +2675,13 @@
         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,10 +2748,13 @@
     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,10 +2831,12 @@
      * 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,10 +2844,12 @@
      * 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,10 +3211,12 @@
     /**
      * 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,14 +4316,19 @@
         /**
          * Whether or not the drawing buffer has been recently restored from
          * a lost state.
          */
         protected boolean validatedContents; // = false
+
         /**
-         * Size of the back buffers
+         * 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,10 +4365,12 @@
             }
         }
 
         /**
          * Creates the back buffers
+         *
+         * @param numBuffers the number of buffers to create
          */
         protected void createBackBuffers(int numBuffers) {
             if (numBuffers == 0) {
                 backBuffers = null;
             } else {

@@ -4591,10 +4656,13 @@
      * <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,20 +4685,29 @@
 
     /**
      * 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,11 +4716,14 @@
 
     /**
      * 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,10 +4754,17 @@
     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,18 +4773,20 @@
 
     /**
      * 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,10 +6833,12 @@
             }
         }
     }
 
     /**
+     * @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,82 +6878,115 @@
         }
         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,19 +7192,25 @@
             }
         }
     }
 
     /**
+     * @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,22 +8518,23 @@
 
     /**
      * 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) {
+    public PropertyChangeListener[] getPropertyChangeListeners(String propertyName) {
         synchronized (getObjectLock()) {
             if (changeSupport == null) {
                 return new PropertyChangeListener[0];
             }
             return changeSupport.getPropertyChangeListeners(propertyName);

@@ -8877,10 +9008,11 @@
      * {@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,10 +9036,11 @@
      * 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,11 +9194,20 @@
          * 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..