# HG changeset patch # User volk # Date 1208116580 -14400 # Node ID b40ad157413b57539ae6312a9354b5d87be0aa95 # Parent b49bc385fa7e628fc5a6ce28dc242691468af80a# Parent 687798d7d7b64de1d5d2efacd4de42cc77bd5b0f Merge diff -r b49bc385fa7e -r b40ad157413b jdk/src/share/classes/java/awt/Component.java --- a/jdk/src/share/classes/java/awt/Component.java Sun Apr 13 23:41:40 2008 +0400 +++ b/jdk/src/share/classes/java/awt/Component.java Sun Apr 13 23:56:20 2008 +0400 @@ -1327,12 +1327,15 @@ KeyboardFocusManager.clearMostRecentFocusOwner(this); synchronized (getTreeLock()) { enabled = false; - if (isFocusOwner()) { + // A disabled lw container is allowed to contain a focus owner. + if ((isFocusOwner() || (containsFocus() && !isLightweight())) && + KeyboardFocusManager.isAutoFocusTransferEnabled()) + { // Don't clear the global focus owner. If transferFocus // fails, we want the focus to stay on the disabled // Component so that keyboard traversal, et. al. still // makes sense to the user. - autoTransferFocus(false); + transferFocus(false); } ComponentPeer peer = this.peer; if (peer != null) { @@ -1493,8 +1496,8 @@ synchronized (getTreeLock()) { visible = false; mixOnHiding(isLightweight()); - if (containsFocus()) { - autoTransferFocus(true); + if (containsFocus() && KeyboardFocusManager.isAutoFocusTransferEnabled()) { + transferFocus(true); } ComponentPeer peer = this.peer; if (peer != null) { @@ -6578,12 +6581,8 @@ } synchronized (getTreeLock()) { - if (isFocusOwner() - && KeyboardFocusManager.isAutoFocusTransferEnabled() - && !nextFocusHelper()) - { - KeyboardFocusManager.getCurrentKeyboardFocusManager(). - clearGlobalFocusOwner(); + if (isFocusOwner() && KeyboardFocusManager.isAutoFocusTransferEnabledFor(this)) { + transferFocus(true); } if (getContainer() != null && isAddNotifyComplete) { @@ -6718,8 +6717,8 @@ firePropertyChange("focusable", oldFocusable, focusable); if (oldFocusable && !focusable) { - if (isFocusOwner()) { - autoTransferFocus(true); + if (isFocusOwner() && KeyboardFocusManager.isAutoFocusTransferEnabled()) { + transferFocus(true); } KeyboardFocusManager.clearMostRecentFocusOwner(this); } @@ -7373,69 +7372,6 @@ } } - private void autoTransferFocus(boolean clearOnFailure) { - Component toTest = KeyboardFocusManager. - getCurrentKeyboardFocusManager().getFocusOwner(); - if (toTest != this) { - if (toTest != null) { - toTest.autoTransferFocus(clearOnFailure); - } - return; - } - - // Check if there are pending focus requests. We shouldn't do - // auto-transfer if user has already took care of this - // component becoming ineligible to hold focus. - if (!KeyboardFocusManager.isAutoFocusTransferEnabled()) { - return; - } - - // the following code will execute only if this Component is the focus - // owner - - if (!(isDisplayable() && isVisible() && isEnabled() && isFocusable())) { - doAutoTransfer(clearOnFailure); - return; - } - - toTest = getParent(); - - while (toTest != null && !(toTest instanceof Window)) { - if (!(toTest.isDisplayable() && toTest.isVisible() && - (toTest.isEnabled() || toTest.isLightweight()))) { - doAutoTransfer(clearOnFailure); - return; - } - toTest = toTest.getParent(); - } - } - private void doAutoTransfer(boolean clearOnFailure) { - if (focusLog.isLoggable(Level.FINER)) { - focusLog.log(Level.FINER, "this = " + this + ", clearOnFailure = " + clearOnFailure); - } - if (clearOnFailure) { - if (!nextFocusHelper()) { - if (focusLog.isLoggable(Level.FINER)) { - focusLog.log(Level.FINER, "clear global focus owner"); - } - KeyboardFocusManager.getCurrentKeyboardFocusManager(). - clearGlobalFocusOwner(); - } - } else { - transferFocus(); - } - } - - /** - * Transfers the focus to the next component, as though this Component were - * the focus owner. - * @see #requestFocus() - * @since JDK1.1 - */ - public void transferFocus() { - nextFocus(); - } - /** * Returns the Container which is the focus cycle root of this Component's * focus traversal cycle. Each focus traversal cycle has only a single @@ -7475,31 +7411,51 @@ return (rootAncestor == container); } + Container getTraversalRoot() { + return getFocusCycleRootAncestor(); + } + + /** + * Transfers the focus to the next component, as though this Component were + * the focus owner. + * @see #requestFocus() + * @since JDK1.1 + */ + public void transferFocus() { + nextFocus(); + } + /** * @deprecated As of JDK version 1.1, * replaced by transferFocus(). */ @Deprecated public void nextFocus() { - nextFocusHelper(); - } - - private boolean nextFocusHelper() { - Component toFocus = preNextFocusHelper(); + transferFocus(false); + } + + boolean transferFocus(boolean clearOnFailure) { if (focusLog.isLoggable(Level.FINER)) { - focusLog.log(Level.FINER, "toFocus = " + toFocus); - } - if (isFocusOwner() && toFocus == this) { - return false; - } - return postNextFocusHelper(toFocus, CausedFocusEvent.Cause.TRAVERSAL_FORWARD); - } - - Container getTraversalRoot() { - return getFocusCycleRootAncestor(); - } - - final Component preNextFocusHelper() { + focusLog.finer("clearOnFailure = " + clearOnFailure); + } + Component toFocus = getNextFocusCandidate(); + boolean res = false; + if (toFocus != null && !toFocus.isFocusOwner() && toFocus != this) { + res = toFocus.requestFocusInWindow(CausedFocusEvent.Cause.TRAVERSAL_FORWARD); + } + if (clearOnFailure && !res) { + if (focusLog.isLoggable(Level.FINER)) { + focusLog.finer("clear global focus owner"); + } + KeyboardFocusManager.getCurrentKeyboardFocusManager().clearGlobalFocusOwner(); + } + if (focusLog.isLoggable(Level.FINER)) { + focusLog.finer("returning result: " + res); + } + return res; + } + + final Component getNextFocusCandidate() { Container rootAncestor = getTraversalRoot(); Component comp = this; while (rootAncestor != null && @@ -7511,18 +7467,19 @@ rootAncestor = comp.getFocusCycleRootAncestor(); } if (focusLog.isLoggable(Level.FINER)) { - focusLog.log(Level.FINER, "comp = " + comp + ", root = " + rootAncestor); - } + focusLog.finer("comp = " + comp + ", root = " + rootAncestor); + } + Component candidate = null; if (rootAncestor != null) { FocusTraversalPolicy policy = rootAncestor.getFocusTraversalPolicy(); Component toFocus = policy.getComponentAfter(rootAncestor, comp); if (focusLog.isLoggable(Level.FINER)) { - focusLog.log(Level.FINER, "component after is " + toFocus); + focusLog.finer("component after is " + toFocus); } if (toFocus == null) { toFocus = policy.getDefaultComponent(rootAncestor); if (focusLog.isLoggable(Level.FINER)) { - focusLog.log(Level.FINER, "default component is " + toFocus); + focusLog.finer("default component is " + toFocus); } } if (toFocus == null) { @@ -7531,23 +7488,12 @@ toFocus = applet; } } - return toFocus; - } - return null; - } - - static boolean postNextFocusHelper(Component toFocus, CausedFocusEvent.Cause cause) { - if (toFocus != null) { - if (focusLog.isLoggable(Level.FINER)) { - focusLog.log(Level.FINER, "Next component " + toFocus); - } - boolean res = toFocus.requestFocusInWindow(cause); - if (focusLog.isLoggable(Level.FINER)) { - focusLog.log(Level.FINER, "Request focus returned " + res); - } - return res; - } - return false; + candidate = toFocus; + } + if (focusLog.isLoggable(Level.FINER)) { + focusLog.finer("Focus transfer candidate: " + candidate); + } + return candidate; } /** @@ -7557,6 +7503,10 @@ * @since 1.4 */ public void transferFocusBackward() { + transferFocusBackward(false); + } + + boolean transferFocusBackward(boolean clearOnFailure) { Container rootAncestor = getTraversalRoot(); Component comp = this; while (rootAncestor != null && @@ -7567,6 +7517,7 @@ comp = rootAncestor; rootAncestor = comp.getFocusCycleRootAncestor(); } + boolean res = false; if (rootAncestor != null) { FocusTraversalPolicy policy = rootAncestor.getFocusTraversalPolicy(); Component toFocus = policy.getComponentBefore(rootAncestor, comp); @@ -7574,9 +7525,19 @@ toFocus = policy.getDefaultComponent(rootAncestor); } if (toFocus != null) { - toFocus.requestFocusInWindow(CausedFocusEvent.Cause.TRAVERSAL_BACKWARD); - } - } + res = toFocus.requestFocusInWindow(CausedFocusEvent.Cause.TRAVERSAL_BACKWARD); + } + } + if (!res) { + if (focusLog.isLoggable(Level.FINER)) { + focusLog.finer("clear global focus owner"); + } + KeyboardFocusManager.getCurrentKeyboardFocusManager().clearGlobalFocusOwner(); + } + if (focusLog.isLoggable(Level.FINER)) { + focusLog.finer("returning result: " + res); + } + return res; } /** @@ -7651,6 +7612,20 @@ return hasFocus(); } + /* + * Used to disallow auto-focus-transfer on disposal of the focus owner + * in the process of disposing its parent container. + */ + private boolean autoFocusTransferOnDisposal = true; + + void setAutoFocusTransferOnDisposal(boolean value) { + autoFocusTransferOnDisposal = value; + } + + boolean isAutoFocusTransferOnDisposal() { + return autoFocusTransferOnDisposal; + } + /** * Adds the specified popup menu to the component. * @param popup the popup menu to be added to the component. diff -r b49bc385fa7e -r b40ad157413b jdk/src/share/classes/java/awt/Container.java --- a/jdk/src/share/classes/java/awt/Container.java Sun Apr 13 23:41:40 2008 +0400 +++ b/jdk/src/share/classes/java/awt/Container.java Sun Apr 13 23:56:20 2008 +0400 @@ -2660,9 +2660,26 @@ synchronized (getTreeLock()) { int ncomponents = this.ncomponents; Component component[] = this.component; - for (int i = ncomponents-1 ; i >= 0 ; i--) { - if( component[i] != null ) - component[i].removeNotify(); + for (int i = ncomponents - 1; i >= 0; i--) { + if( component[i] != null ) { + // Fix for 6607170. + // We want to suppress focus change on disposal + // of the focused component. But because of focus + // is asynchronous, we should suppress focus change + // on every component in case it receives native focus + // in the process of disposal. + component[i].setAutoFocusTransferOnDisposal(false); + component[i].removeNotify(); + component[i].setAutoFocusTransferOnDisposal(true); + } + } + // If some of the children had focus before disposal then it still has. + // Auto-transfer focus to the next (or previous) component if auto-transfer + // is enabled. + if (containsFocus() && KeyboardFocusManager.isAutoFocusTransferEnabledFor(this)) { + if (!transferFocus(false)) { + transferFocusBackward(true); + } } if ( dispatcher != null ) { dispatcher.dispose(); diff -r b49bc385fa7e -r b40ad157413b jdk/src/share/classes/java/awt/DefaultKeyboardFocusManager.java --- a/jdk/src/share/classes/java/awt/DefaultKeyboardFocusManager.java Sun Apr 13 23:41:40 2008 +0400 +++ b/jdk/src/share/classes/java/awt/DefaultKeyboardFocusManager.java Sun Apr 13 23:56:20 2008 +0400 @@ -155,12 +155,13 @@ boolean clearOnFailure) { if (toFocus != vetoedComponent && toFocus.isShowing() && toFocus.isFocusable() && - toFocus.requestFocus(false, CausedFocusEvent.Cause.ROLLBACK)) { + toFocus.requestFocus(false, CausedFocusEvent.Cause.ROLLBACK)) + { return true; } else { - Component nextFocus = toFocus.preNextFocusHelper(); - if (nextFocus != vetoedComponent - && Component.postNextFocusHelper(nextFocus, CausedFocusEvent.Cause.ROLLBACK)) + Component nextFocus = toFocus.getNextFocusCandidate(); + if (nextFocus != null && nextFocus != vetoedComponent && + nextFocus.requestFocusInWindow(CausedFocusEvent.Cause.ROLLBACK)) { return true; } else if (clearOnFailure) { @@ -504,9 +505,16 @@ { // we should not accept focus on such component, so reject it. dequeueKeyEvents(-1, newFocusOwner); - if (KeyboardFocusManager.isAutoFocusTransferEnabled()) - { - restoreFocus(fe, newFocusedWindow); + if (KeyboardFocusManager.isAutoFocusTransferEnabled()) { + // If FOCUS_GAINED is for a disposed component (however + // it shouldn't happen) its toplevel parent is null. In this + // case we have to try to restore focus in the current focused + // window (for the details: 6607170). + if (newFocusedWindow == null) { + restoreFocus(fe, currentFocusedWindow); + } else { + restoreFocus(fe, newFocusedWindow); + } } break; } diff -r b49bc385fa7e -r b40ad157413b jdk/src/share/classes/java/awt/KeyboardFocusManager.java --- a/jdk/src/share/classes/java/awt/KeyboardFocusManager.java Sun Apr 13 23:41:40 2008 +0400 +++ b/jdk/src/share/classes/java/awt/KeyboardFocusManager.java Sun Apr 13 23:56:20 2008 +0400 @@ -2578,6 +2578,10 @@ } } + static boolean isAutoFocusTransferEnabledFor(Component comp) { + return isAutoFocusTransferEnabled() && comp.isAutoFocusTransferOnDisposal(); + } + /* * Used to process exceptions in dispatching focus event (in focusLost/focusGained callbacks). * @param ex previously caught exception that may be processed right here, or null diff -r b49bc385fa7e -r b40ad157413b jdk/src/share/classes/java/awt/dnd/DragGestureEvent.java --- a/jdk/src/share/classes/java/awt/dnd/DragGestureEvent.java Sun Apr 13 23:41:40 2008 +0400 +++ b/jdk/src/share/classes/java/awt/dnd/DragGestureEvent.java Sun Apr 13 23:56:20 2008 +0400 @@ -1,5 +1,5 @@ /* - * Copyright 1998-2006 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1998-2008 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -55,9 +55,19 @@ * platform dependent drag initiating gesture has occurred * on the Component that it is tracking. * + * The {@code action} field of any {@code DragGestureEvent} instance should take one of the following + * values: + * + * Assigning the value different from listed above will cause an unspecified behavior. + * * @see java.awt.dnd.DragGestureRecognizer * @see java.awt.dnd.DragGestureListener * @see java.awt.dnd.DragSource + * @see java.awt.dnd.DnDConstants */ public class DragGestureEvent extends EventObject { @@ -65,19 +75,25 @@ private static final long serialVersionUID = 9080172649166731306L; /** - * Constructs a DragGestureEvent given the - * DragGestureRecognizer firing this event, - * an int representing - * the user's preferred action, a Point - * indicating the origin of the drag, and a List - * of events that comprise the gesture. + * Constructs a DragGestureEvent object given by the + * DragGestureRecognizer instance firing this event, + * an {@code act} parameter representing + * the user's preferred action, an {@code ori} parameter + * indicating the origin of the drag, and a {@code List} of + * events that comprise the gesture({@code evs} parameter). *

* @param dgr The DragGestureRecognizer firing this event - * @param act The the user's preferred action + * @param act The user's preferred action. + * For information on allowable values, see + * the class description for {@link DragGestureEvent} * @param ori The origin of the drag * @param evs The List of events that comprise the gesture *

- * @throws IllegalArgumentException if input parameters are {@code null} + * @throws IllegalArgumentException if any parameter equals {@code null} + * @throws IllegalArgumentException if the act parameter does not comply with + * the values given in the class + * description for {@link DragGestureEvent} + * @see java.awt.dnd.DnDConstants */ public DragGestureEvent(DragGestureRecognizer dgr, int act, Point ori, diff -r b49bc385fa7e -r b40ad157413b jdk/src/share/classes/java/awt/dnd/DropTargetEvent.java --- a/jdk/src/share/classes/java/awt/dnd/DropTargetEvent.java Sun Apr 13 23:41:40 2008 +0400 +++ b/jdk/src/share/classes/java/awt/dnd/DropTargetEvent.java Sun Apr 13 23:56:20 2008 +0400 @@ -45,10 +45,13 @@ private static final long serialVersionUID = 2821229066521922993L; /** - * Construct a DropTargetEvent with - * a specified DropTargetContext. + * Construct a DropTargetEvent object with + * the specified DropTargetContext. *

- * @param dtc the DropTargetContext + * @param dtc The DropTargetContext + * @throws NullPointerException if {@code dtc} equals {@code null}. + * @see #getSource() + * @see #getDropTargetContext() */ public DropTargetEvent(DropTargetContext dtc) { diff -r b49bc385fa7e -r b40ad157413b jdk/src/share/classes/java/awt/event/ActionEvent.java --- a/jdk/src/share/classes/java/awt/event/ActionEvent.java Sun Apr 13 23:41:40 2008 +0400 +++ b/jdk/src/share/classes/java/awt/event/ActionEvent.java Sun Apr 13 23:56:20 2008 +0400 @@ -1,5 +1,5 @@ /* - * Copyright 1996-2006 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1996-2008 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -45,6 +45,10 @@ * is therefore spared the details of processing individual mouse movements * and mouse clicks, and can instead process a "meaningful" (semantic) * event like "button pressed". + *

+ * An unspecified behavior will be caused if the {@code id} parameter + * of any particular {@code ActionEvent} instance is not + * in the range from {@code ACTION_FIRST} to {@code ACTION_LAST}. * * @see ActionListener * @see Tutorial: Java 1.1 Event Model @@ -134,18 +138,22 @@ /** * Constructs an ActionEvent object. *

- * Note that passing in an invalid id results in - * unspecified behavior. This method throws an + * This method throws an * IllegalArgumentException if source * is null. * A null command string is legal, * but not recommended. * - * @param source the object that originated the event - * @param id an integer that identifies the event - * @param command a string that may specify a command (possibly one + * @param source The object that originated the event + * @param id An integer that identifies the event. + * For information on allowable values, see + * the class description for {@link ActionEvent} + * @param command A string that may specify a command (possibly one * of several) associated with the event * @throws IllegalArgumentException if source is null + * @see #getSource() + * @see #getID() + * @see #getActionCommand() */ public ActionEvent(Object source, int id, String command) { this(source, id, command, 0); @@ -154,19 +162,27 @@ /** * Constructs an ActionEvent object with modifier keys. *

- * Note that passing in an invalid id results in - * unspecified behavior. This method throws an + * This method throws an * IllegalArgumentException if source * is null. * A null command string is legal, * but not recommended. * - * @param source the object that originated the event - * @param id an integer that identifies the event - * @param command a string that may specify a command (possibly one - * of several) associated with the event - * @param modifiers the modifier keys held down during this action + * @param source The object that originated the event + * @param id An integer that identifies the event. + * For information on allowable values, see + * the class description for {@link ActionEvent} + * @param command A string that may specify a command (possibly one + * of several) associated with the event + * @param modifiers The modifier keys down during event + * (shift, ctrl, alt, meta). + * Passing negative parameter is not recommended. + * Zero value means that no modifiers were passed * @throws IllegalArgumentException if source is null + * @see #getSource() + * @see #getID() + * @see #getActionCommand() + * @see #getModifiers() */ public ActionEvent(Object source, int id, String command, int modifiers) { this(source, id, command, 0, modifiers); @@ -176,20 +192,31 @@ * Constructs an ActionEvent object with the specified * modifier keys and timestamp. *

- * Note that passing in an invalid id results in - * unspecified behavior. This method throws an + * This method throws an * IllegalArgumentException if source * is null. * A null command string is legal, * but not recommended. * - * @param source the object that originated the event - * @param id an integer that identifies the event - * @param command a string that may specify a command (possibly one - * of several) associated with the event - * @param when the time the event occurred - * @param modifiers the modifier keys held down during this action + * @param source The object that originated the event + * @param id An integer that identifies the event. + * For information on allowable values, see + * the class description for {@link ActionEvent} + * @param command A string that may specify a command (possibly one + * of several) associated with the event + * @param modifiers The modifier keys down during event + * (shift, ctrl, alt, meta). + * Passing negative parameter is not recommended. + * Zero value means that no modifiers were passed + * @param when A long that gives the time the event occurred. + * Passing negative or zero value + * is not recommended * @throws IllegalArgumentException if source is null + * @see #getSource() + * @see #getID() + * @see #getActionCommand() + * @see #getModifiers() + * @see #getWhen() * * @since 1.4 */ diff -r b49bc385fa7e -r b40ad157413b jdk/src/share/classes/java/awt/event/AdjustmentEvent.java --- a/jdk/src/share/classes/java/awt/event/AdjustmentEvent.java Sun Apr 13 23:41:40 2008 +0400 +++ b/jdk/src/share/classes/java/awt/event/AdjustmentEvent.java Sun Apr 13 23:56:20 2008 +0400 @@ -29,7 +29,25 @@ import java.awt.AWTEvent; /** - * The adjustment event emitted by Adjustable objects. + * The adjustment event emitted by Adjustable objects like + * {@link java.awt.Scrollbar} and {@link java.awt.ScrollPane}. + * When the user changes the value of the scrolling component, + * it receives an instance of {@code AdjustmentEvent}. + *

+ * An unspecified behavior will be caused if the {@code id} parameter + * of any particular {@code AdjustmentEvent} instance is not + * in the range from {@code ADJUSTMENT_FIRST} to {@code ADJUSTMENT_LAST}. + *

+ * The {@code type} of any {@code AdjustmentEvent} instance takes one of the following + * values: + *

+ * Assigning the value different from listed above will cause an unspecified behavior. * @see java.awt.Adjustable * @see AdjustmentListener * @@ -130,17 +148,24 @@ * Constructs an AdjustmentEvent object with the * specified Adjustable source, event type, * adjustment type, and value. - *

Note that passing in an invalid id results in - * unspecified behavior. This method throws an + *

This method throws an * IllegalArgumentException if source * is null. * - * @param source the Adjustable object where the + * @param source The Adjustable object where the * event originated - * @param id the event type - * @param type the adjustment type - * @param value the current value of the adjustment + * @param id An integer indicating the type of event. + * For information on allowable values, see + * the class description for {@link AdjustmentEvent} + * @param type An integer indicating the adjustment type. + * For information on allowable values, see + * the class description for {@link AdjustmentEvent} + * @param value The current value of the adjustment * @throws IllegalArgumentException if source is null + * @see #getSource() + * @see #getID() + * @see #getAdjustmentType() + * @see #getValue() */ public AdjustmentEvent(Adjustable source, int id, int type, int value) { this(source, id, type, value, false); @@ -149,22 +174,29 @@ /** * Constructs an AdjustmentEvent object with the * specified Adjustable source, event type, adjustment type, and value. - *

Note that passing in an invalid id results in - * unspecified behavior. This method throws an + *

This method throws an * IllegalArgumentException if source * is null. - * - * @param source the Adjustable object where the + * @param source The Adjustable object where the * event originated - * @param id the event type - * @param type the adjustment type - * @param value the current value of the adjustment - * @param isAdjusting true if the event is one + * @param id An integer indicating the type of event. + * For information on allowable values, see + * the class description for {@link AdjustmentEvent} + * @param type An integer indicating the adjustment type. + * For information on allowable values, see + * the class description for {@link AdjustmentEvent} + * @param value The current value of the adjustment + * @param isAdjusting A boolean that equals true if the event is one * of a series of multiple adjusting events, * otherwise false * @throws IllegalArgumentException if source is null * @since 1.4 + * @see #getSource() + * @see #getID() + * @see #getAdjustmentType() + * @see #getValue() + * @see #getValueIsAdjusting() */ public AdjustmentEvent(Adjustable source, int id, int type, int value, boolean isAdjusting) { super(source, id); diff -r b49bc385fa7e -r b40ad157413b jdk/src/share/classes/java/awt/event/ComponentEvent.java --- a/jdk/src/share/classes/java/awt/event/ComponentEvent.java Sun Apr 13 23:41:40 2008 +0400 +++ b/jdk/src/share/classes/java/awt/event/ComponentEvent.java Sun Apr 13 23:56:20 2008 +0400 @@ -52,6 +52,10 @@ * (ComponentAdapter objects implement the * ComponentListener interface.) Each such listener object * gets this ComponentEvent when the event occurs. + *

+ * An unspecified behavior will be caused if the {@code id} parameter + * of any particular {@code ComponentEvent} instance is not + * in the range from {@code COMPONENT_FIRST} to {@code COMPONENT_LAST}. * * @see ComponentAdapter * @see ComponentListener @@ -99,14 +103,17 @@ /** * Constructs a ComponentEvent object. - *

Note that passing in an invalid id results in - * unspecified behavior. This method throws an + *

This method throws an * IllegalArgumentException if source * is null. * - * @param source the Component that originated the event - * @param id an integer indicating the type of event + * @param source The Component that originated the event + * @param id An integer indicating the type of event. + * For information on allowable values, see + * the class description for {@link ComponentEvent} * @throws IllegalArgumentException if source is null + * @see #getComponent() + * @see #getID() */ public ComponentEvent(Component source, int id) { super(source, id); diff -r b49bc385fa7e -r b40ad157413b jdk/src/share/classes/java/awt/event/ContainerEvent.java --- a/jdk/src/share/classes/java/awt/event/ContainerEvent.java Sun Apr 13 23:41:40 2008 +0400 +++ b/jdk/src/share/classes/java/awt/event/ContainerEvent.java Sun Apr 13 23:56:20 2008 +0400 @@ -45,6 +45,10 @@ * (ContainerAdapter objects implement the * ContainerListener interface.) Each such listener object * gets this ContainerEvent when the event occurs. + *

+ * An unspecified behavior will be caused if the {@code id} parameter + * of any particular {@code ContainerEvent} instance is not + * in the range from {@code CONTAINER_FIRST} to {@code CONTAINER_LAST}. * * @see ContainerAdapter * @see ContainerListener @@ -92,16 +96,20 @@ /** * Constructs a ContainerEvent object. - *

Note that passing in an invalid id results in - * unspecified behavior. This method throws an + *

This method throws an * IllegalArgumentException if source * is null. * - * @param source the Component object (container) + * @param source The Component object (container) * that originated the event - * @param id an integer indicating the type of event + * @param id An integer indicating the type of event. + * For information on allowable values, see + * the class description for {@link ContainerEvent} * @param child the component that was added or removed * @throws IllegalArgumentException if source is null + * @see #getContainer() + * @see #getID() + * @see #getChild() */ public ContainerEvent(Component source, int id, Component child) { super(source, id); diff -r b49bc385fa7e -r b40ad157413b jdk/src/share/classes/java/awt/event/FocusEvent.java --- a/jdk/src/share/classes/java/awt/event/FocusEvent.java Sun Apr 13 23:41:40 2008 +0400 +++ b/jdk/src/share/classes/java/awt/event/FocusEvent.java Sun Apr 13 23:56:20 2008 +0400 @@ -50,6 +50,10 @@ * reactivated. Both permanent and temporary focus events are delivered using * the FOCUS_GAINED and FOCUS_LOST event ids; the level may be distinguished in * the event using the isTemporary() method. + *

+ * An unspecified behavior will be caused if the {@code id} parameter + * of any particular {@code FocusEvent} instance is not + * in the range from {@code FOCUS_FIRST} to {@code FOCUS_LAST}. * * @see FocusAdapter * @see FocusListener @@ -121,18 +125,23 @@ * application, with a Java application in a different VM, * or with no other Component, then the opposite * Component is null. - *

Note that passing in an invalid id results in - * unspecified behavior. This method throws an + *

This method throws an * IllegalArgumentException if source * is null. * - * @param source the Component that originated the event - * @param id FOCUS_GAINED or FOCUS_LOST - * @param temporary true if the focus change is temporary; + * @param source The Component that originated the event + * @param id An integer indicating the type of event. + * For information on allowable values, see + * the class description for {@link FocusEvent} + * @param temporary Equals true if the focus change is temporary; * false otherwise - * @param opposite the other Component involved in the focus change, + * @param opposite The other Component involved in the focus change, * or null - * @throws IllegalArgumentException if source is null + * @throws IllegalArgumentException if source equals {@code null} + * @see #getSource() + * @see #getID() + * @see #isTemporary() + * @see #getOppositeComponent() * @since 1.4 */ public FocusEvent(Component source, int id, boolean temporary, @@ -145,16 +154,20 @@ /** * Constructs a FocusEvent object and identifies * whether or not the change is temporary. - *

Note that passing in an invalid id results in - * unspecified behavior. This method throws an + *

This method throws an * IllegalArgumentException if source * is null. * - * @param source the Component that originated the event - * @param id an integer indicating the type of event - * @param temporary true if the focus change is temporary; + * @param source The Component that originated the event + * @param id An integer indicating the type of event. + * For information on allowable values, see + * the class description for {@link FocusEvent} + * @param temporary Equals true if the focus change is temporary; * false otherwise - * @throws IllegalArgumentException if source is null + * @throws IllegalArgumentException if source equals {@code null} + * @see #getSource() + * @see #getID() + * @see #isTemporary() */ public FocusEvent(Component source, int id, boolean temporary) { this(source, id, temporary, null); @@ -163,14 +176,17 @@ /** * Constructs a FocusEvent object and identifies it * as a permanent change in focus. - *

Note that passing in an invalid id results in - * unspecified behavior. This method throws an + *

This method throws an * IllegalArgumentException if source * is null. * - * @param source the Component that originated the event - * @param id an integer indicating the type of event - * @throws IllegalArgumentException if source is null + * @param source The Component that originated the event + * @param id An integer indicating the type of event. + * For information on allowable values, see + * the class description for {@link FocusEvent} + * @throws IllegalArgumentException if source equals {@code null} + * @see #getSource() + * @see #getID() */ public FocusEvent(Component source, int id) { this(source, id, false); diff -r b49bc385fa7e -r b40ad157413b jdk/src/share/classes/java/awt/event/HierarchyEvent.java --- a/jdk/src/share/classes/java/awt/event/HierarchyEvent.java Sun Apr 13 23:41:40 2008 +0400 +++ b/jdk/src/share/classes/java/awt/event/HierarchyEvent.java Sun Apr 13 23:56:20 2008 +0400 @@ -1,5 +1,5 @@ /* - * Copyright 1999-2004 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1999-2008 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -31,7 +31,7 @@ /** * An event which indicates a change to the Component - * hierarchy to which a Component belongs. + * hierarchy to which Component belongs. *