# HG changeset patch
# User lana
# Date 1376434177 25200
# Node ID 9dc631273af7ab1253511779eac583948c3f6d1d
# Parent 424d84a2276f3faa50180cbabbdafbfe49770bfe# Parent 30a1d677a20c6a95f98043d8f20ce570304e3818
Merge
diff -r 30a1d677a20c -r 9dc631273af7 jdk/src/share/classes/java/awt/KeyboardFocusManager.java
--- a/jdk/src/share/classes/java/awt/KeyboardFocusManager.java Wed Jul 05 19:07:31 2017 +0200
+++ b/jdk/src/share/classes/java/awt/KeyboardFocusManager.java Tue Aug 13 15:49:37 2013 -0700
@@ -2426,7 +2426,8 @@
focusLog.finest("Request {0}", String.valueOf(hwFocusRequest));
}
if (hwFocusRequest == null &&
- heavyweight == nativeFocusOwner)
+ heavyweight == nativeFocusOwner &&
+ heavyweight.getContainingWindow() == nativeFocusedWindow)
{
if (descendant == currentFocusOwner) {
// Redundant request.
diff -r 30a1d677a20c -r 9dc631273af7 jdk/src/share/classes/java/awt/Window.java
--- a/jdk/src/share/classes/java/awt/Window.java Wed Jul 05 19:07:31 2017 +0200
+++ b/jdk/src/share/classes/java/awt/Window.java Tue Aug 13 15:49:37 2013 -0700
@@ -62,18 +62,18 @@
import sun.util.logging.PlatformLogger;
/**
- * A Window
object is a top-level window with no borders and no
+ * A {@code Window} object is a top-level window with no borders and no
* menubar.
- * The default layout for a window is BorderLayout
.
+ * The default layout for a window is {@code BorderLayout}.
*
* A window must have either a frame, dialog, or another window defined as its * owner when it's constructed. *
- * In a multi-screen environment, you can create a Window
- * on a different screen device by constructing the Window
+ * In a multi-screen environment, you can create a {@code Window}
+ * on a different screen device by constructing the {@code Window}
* with {@link #Window(Window, GraphicsConfiguration)}. The
- * GraphicsConfiguration
object is one of the
- * GraphicsConfiguration
objects of the target screen device.
+ * {@code GraphicsConfiguration} object is one of the
+ * {@code GraphicsConfiguration} objects of the target screen device.
*
* In a virtual device multi-screen environment in which the desktop * area could span multiple physical screen devices, the bounds of all @@ -87,21 +87,21 @@ * alt="Diagram shows virtual device containing 4 physical screens. Primary physical screen shows coords (0,0), other screen shows (-80,-100)." * ALIGN=center HSPACE=10 VSPACE=7> *
- * In such an environment, when calling setLocation
,
+ * In such an environment, when calling {@code setLocation},
* you must pass a virtual coordinate to this method. Similarly,
- * calling getLocationOnScreen
on a Window
returns
- * virtual device coordinates. Call the getBounds
method
- * of a GraphicsConfiguration
to find its origin in the virtual
+ * calling {@code getLocationOnScreen} on a {@code Window} returns
+ * virtual device coordinates. Call the {@code getBounds} method
+ * of a {@code GraphicsConfiguration} to find its origin in the virtual
* coordinate system.
*
- * The following code sets the location of a Window
+ * The following code sets the location of a {@code Window}
* at (10, 10) relative to the origin of the physical screen
- * of the corresponding GraphicsConfiguration
. If the
- * bounds of the GraphicsConfiguration
is not taken
- * into account, the Window
location would be set
+ * of the corresponding {@code GraphicsConfiguration}. If the
+ * bounds of the {@code GraphicsConfiguration} is not taken
+ * into account, the {@code Window} location would be set
* at (10, 10) relative to the virtual-coordinate system and would appear
* on the primary physical screen, which might be different from the
- * physical screen of the specified GraphicsConfiguration
.
+ * physical screen of the specified {@code GraphicsConfiguration}.
*
*
* Window w = new Window(Window owner, GraphicsConfiguration gc); @@ -111,19 +111,19 @@ * ** Note: the location and size of top-level windows (including - *
Window
s,Frame
s, andDialog
s) + * {@code Window}s, {@code Frame}s, and {@code Dialog}s) * are under the control of the desktop's window management system. - * Calls tosetLocation
,setSize
, and - *setBounds
are requests (not directives) which are + * Calls to {@code setLocation}, {@code setSize}, and + * {@code setBounds} are requests (not directives) which are * forwarded to the window management system. Every effort will be * made to honor such requests. However, in some cases the window * management system may ignore such requests, or modify the requested - * geometry in order to place and size theWindow
in a way + * geometry in order to place and size the {@code Window} in a way * that more closely matches the desktop settings. ** Due to the asynchronous nature of native event handling, the results - * returned by
getBounds
,getLocation
, - *getLocationOnScreen
, andgetSize
might not + * returned by {@code getBounds}, {@code getLocation}, + * {@code getLocationOnScreen}, and {@code getSize} might not * reflect the actual geometry of the Window on screen until the last * request has been processed. During the processing of subsequent * requests these values might change accordingly while the window @@ -340,7 +340,7 @@ */ transient boolean isInShow = false; - /* + /** * The opacity level of the window * * @serial @@ -350,7 +350,7 @@ */ private float opacity = 1.0f; - /* + /** * The shape assigned to this window. This field is set to {@code null} if * no shape is set (rectangular window). * @@ -415,21 +415,21 @@ /** * Constructs a new, initially invisible window in default size with the - * specifiedGraphicsConfiguration
. + * specified {@code GraphicsConfiguration}. ** If there is a security manager, this method first calls - * the security manager's
checkTopLevelWindow
- * method withthis
+ * the security manager's {@code checkTopLevelWindow} + * method with {@code this} * as its argument to determine whether or not the window * must be displayed with a warning banner. * - * @param gc theGraphicsConfiguration
of the target screen - * device. Ifgc
isnull
, the system default - *GraphicsConfiguration
is assumed - * @exception IllegalArgumentException ifgc
+ * @param gc the {@code GraphicsConfiguration} of the target screen + * device. If {@code gc} is {@code null}, the system default + * {@code GraphicsConfiguration} is assumed + * @exception IllegalArgumentException if {@code gc} * is not from a screen device * @exception HeadlessException when - *GraphicsEnvironment.isHeadless()
returnstrue
+ * {@code GraphicsEnvironment.isHeadless()} returns {@code true} * * @see java.awt.GraphicsEnvironment#isHeadless * @see java.lang.SecurityManager#checkTopLevelWindow @@ -513,20 +513,20 @@ * Constructs a new, initially invisible window in the default size. * *First, if there is a security manager, its - *
checkTopLevelWindow
- * method is called withthis
+ * {@code checkTopLevelWindow} + * method is called with {@code this} * as its argument * to see if it's ok to display the window without a warning banner. - * If the default implementation ofcheckTopLevelWindow
+ * If the default implementation of {@code checkTopLevelWindow} * is used (that is, that method is not overriden), then this results in - * a call to the security manager'scheckPermission
method - * with anAWTPermission("showWindowWithoutWarningBanner")
+ * a call to the security manager's {@code checkPermission} method + * with an {@code AWTPermission("showWindowWithoutWarningBanner")} * permission. It that method raises a SecurityException, - *checkTopLevelWindow
returns false, otherwise it + * {@code checkTopLevelWindow} returns false, otherwise it * returns true. If it returns false, a warning banner is created. * * @exception HeadlessException when - *GraphicsEnvironment.isHeadless()
returnstrue
+ * {@code GraphicsEnvironment.isHeadless()} returns {@code true} * * @see java.awt.GraphicsEnvironment#isHeadless * @see java.lang.SecurityManager#checkTopLevelWindow @@ -538,21 +538,21 @@ /** * Constructs a new, initially invisible window with the specified - *Frame
as its owner. The window will not be focusable + * {@code Frame} as its owner. The window will not be focusable * unless its owner is showing on the screen. ** If there is a security manager, this method first calls - * the security manager's
checkTopLevelWindow
- * method withthis
+ * the security manager's {@code checkTopLevelWindow} + * method with {@code this} * as its argument to determine whether or not the window * must be displayed with a warning banner. * - * @param owner theFrame
to act as owner ornull
+ * @param owner the {@code Frame} to act as owner or {@code null} * if this window has no owner - * @exception IllegalArgumentException if theowner
's - *GraphicsConfiguration
is not from a screen device + * @exception IllegalArgumentException if the {@code owner}'s + * {@code GraphicsConfiguration} is not from a screen device * @exception HeadlessException when - *GraphicsEnvironment.isHeadless
returnstrue
+ * {@code GraphicsEnvironment.isHeadless} returns {@code true} * * @see java.awt.GraphicsEnvironment#isHeadless * @see java.lang.SecurityManager#checkTopLevelWindow @@ -566,23 +566,23 @@ /** * Constructs a new, initially invisible window with the specified - *Window
as its owner. This window will not be focusable - * unless its nearest owningFrame
orDialog
+ * {@code Window} as its owner. This window will not be focusable + * unless its nearest owning {@code Frame} or {@code Dialog} * is showing on the screen. ** If there is a security manager, this method first calls - * the security manager's
checkTopLevelWindow
- * method withthis
+ * the security manager's {@code checkTopLevelWindow} + * method with {@code this} * as its argument to determine whether or not the window * must be displayed with a warning banner. * - * @param owner theWindow
to act as owner or - *null
if this window has no owner - * @exception IllegalArgumentException if theowner
's - *GraphicsConfiguration
is not from a screen device + * @param owner the {@code Window} to act as owner or + * {@code null} if this window has no owner + * @exception IllegalArgumentException if the {@code owner}'s + * {@code GraphicsConfiguration} is not from a screen device * @exception HeadlessException when - *GraphicsEnvironment.isHeadless()
returns - *true
+ * {@code GraphicsEnvironment.isHeadless()} returns + * {@code true} * * @see java.awt.GraphicsEnvironment#isHeadless * @see java.lang.SecurityManager#checkTopLevelWindow @@ -598,27 +598,27 @@ /** * Constructs a new, initially invisible window with the specified owner - *Window
and aGraphicsConfiguration
+ * {@code Window} and a {@code GraphicsConfiguration} * of a screen device. The Window will not be focusable unless - * its nearest owningFrame
orDialog
+ * its nearest owning {@code Frame} or {@code Dialog} * is showing on the screen. ** If there is a security manager, this method first calls - * the security manager's
checkTopLevelWindow
- * method withthis
+ * the security manager's {@code checkTopLevelWindow} + * method with {@code this} * as its argument to determine whether or not the window * must be displayed with a warning banner. * - * @param owner the window to act as owner ornull
+ * @param owner the window to act as owner or {@code null} * if this window has no owner - * @param gc theGraphicsConfiguration
of the target - * screen device; ifgc
isnull
, - * the system defaultGraphicsConfiguration
is assumed - * @exception IllegalArgumentException ifgc
+ * @param gc the {@code GraphicsConfiguration} of the target + * screen device; if {@code gc} is {@code null}, + * the system default {@code GraphicsConfiguration} is assumed + * @exception IllegalArgumentException if {@code gc} * is not from a screen device * @exception HeadlessException when - *GraphicsEnvironment.isHeadless()
returns - *true
+ * {@code GraphicsEnvironment.isHeadless()} returns + * {@code true} * * @see java.awt.GraphicsEnvironment#isHeadless * @see java.lang.SecurityManager#checkTopLevelWindow @@ -936,7 +936,7 @@ /** * @deprecated As of JDK version 1.1, - * replaced bysetBounds(int, int, int, int)
. + * replaced by {@code setBounds(int, int, int, int)}. */ @Deprecated public void reshape(int x, int y, int width, int height) { @@ -1122,16 +1122,16 @@ /** * Releases all of the native screen resources used by this - *Window
, its subcomponents, and all of its owned - * children. That is, the resources for theseComponent
s + * {@code Window}, its subcomponents, and all of its owned + * children. That is, the resources for these {@code Component}s * will be destroyed, any memory they consume will be returned to the * OS, and they will be marked as undisplayable. *- * The
Window
and its subcomponents can be made displayable + * The {@code Window} and its subcomponents can be made displayable * again by rebuilding the native resources with a subsequent call to - *pack
orshow
. The states of the recreated - *Window
and its subcomponents will be identical to the - * states of these objects at the point where theWindow
+ * {@code pack} or {@code show}. The states of the recreated + * {@code Window} and its subcomponents will be identical to the + * states of these objects at the point where the {@code Window} * was disposed (not accounting for additional modifications between * those actions). *@@ -1363,14 +1363,14 @@ * If this window is insecure, the warning string is displayed * somewhere in the visible area of the window. A window is * insecure if there is a security manager, and the security - * manager's
checkTopLevelWindow
method returns - *false
when this window is passed to it as an + * manager's {@code checkTopLevelWindow} method returns + * {@code false} when this window is passed to it as an * argument. *- * If the window is secure, then
getWarningString
- * returnsnull
. If the window is insecure, this + * If the window is secure, then {@code getWarningString} + * returns {@code null}. If the window is insecure, this * method checks for the system property - *awt.appletWarning
+ * {@code awt.appletWarning} * and returns the string value of that property. * @return the warning string for this window. * @see java.lang.SecurityManager#checkTopLevelWindow(java.lang.Object) @@ -1395,7 +1395,7 @@ } /** - * Gets theLocale
object that is associated + * Gets the {@code Locale} object that is associated * with this window, if the locale has been set. * If no locale has been set, then the default locale * is returned. @@ -1432,7 +1432,7 @@ * implementation and/or the native system do not support * changing the mouse cursor shape. * @param cursor One of the constants defined - * by theCursor
class. If this parameter is null + * by the {@code Cursor} class. If this parameter is null * then the cursor for this window will be set to the type * Cursor.DEFAULT_CURSOR. * @see Component#getCursor @@ -1579,7 +1579,7 @@ * Warning: this method may return system created windows, such * as a print dialog. Applications should not assume the existence of * these dialogs, nor should an application assume anything about these - * dialogs such as component positions,LayoutManager
s + * dialogs such as component positions, {@code LayoutManager}s * or serialization. * * @see Frame#getFrames @@ -1601,7 +1601,7 @@ * Warning: this method may return system created windows, such * as a print dialog. Applications should not assume the existence of * these dialogs, nor should an application assume anything about these - * dialogs such as component positions,LayoutManager
s + * dialogs such as component positions, {@code LayoutManager}s * or serialization. * * @see Frame#getFrames @@ -1646,17 +1646,17 @@ * java.awt.Dialog.ModalExclusionType Dialog.ModalExclusionType} for * possible modal exclusion types. *- * If the given type is not supported,
NO_EXCLUDE
is used. + * If the given type is not supported, {@code NO_EXCLUDE} is used. ** Note: changing the modal exclusion type for a visible window may have no * effect until it is hidden and then shown again. * - * @param exclusionType the modal exclusion type for this window; a
null
+ * @param exclusionType the modal exclusion type for this window; a {@code null} * value is equivivalent to {@link Dialog.ModalExclusionType#NO_EXCLUDE * NO_EXCLUDE} * @throws SecurityException if the calling thread does not have permission * to set the modal exclusion property to the window with the given - *exclusionType
+ * {@code exclusionType} * @see java.awt.Dialog.ModalExclusionType * @see java.awt.Window#getModalExclusionType * @see java.awt.Toolkit#isModalExclusionTypeSupported @@ -1762,7 +1762,7 @@ /** * Adds the specified window state listener to receive window - * events from this window. Ifl
isnull
, + * events from this window. If {@code l} is {@code null}, * no exception is thrown and no action is performed. *Refer to AWT Threading Issues for details on AWT's threading model. @@ -1821,7 +1821,7 @@ /** * Removes the specified window state listener so that it no * longer receives window events from this window. If - *
l
isnull
, no exception is thrown and + * {@code l} is {@code null}, no exception is thrown and * no action is performed. *Refer to AWT Threading Issues for details on AWT's threading model. @@ -1861,7 +1861,7 @@ * Returns an array of all the window listeners * registered on this window. * - * @return all of this window's
WindowListener
s + * @return all of this window's {@code WindowListener}s * or an empty array if no window * listeners are currently registered * @@ -1877,7 +1877,7 @@ * Returns an array of all the window focus listeners * registered on this window. * - * @return all of this window'sWindowFocusListener
s + * @return all of this window's {@code WindowFocusListener}s * or an empty array if no window focus * listeners are currently registered * @@ -1893,7 +1893,7 @@ * Returns an array of all the window state listeners * registered on this window. * - * @return all of this window'sWindowStateListener
s + * @return all of this window's {@code WindowStateListener}s * or an empty array if no window state * listeners are currently registered * @@ -1909,17 +1909,17 @@ /** * Returns an array of all the objects currently registered * asFooListener
s - * upon thisWindow
. + * upon this {@code Window}. *FooListener
s are registered using the *addFooListener
method. * ** - * You can specify the
listenerType
argument + * You can specify the {@code listenerType} argument * with a class literal, such as *FooListener.class
. * For example, you can query a - *Window
w
+ * {@code Window} {@code w} * for its window listeners with the following code: * *WindowListener[] wls = (WindowListener[])(w.getListeners(WindowListener.class));@@ -1928,14 +1928,14 @@ * * @param listenerType the type of listeners requested; this parameter * should specify an interface that descends from - *java.util.EventListener
+ * {@code java.util.EventListener} * @return an array of all objects registered as *FooListener
s on this window, * or an empty array if no such * listeners have been added - * @exception ClassCastException iflistenerType
+ * @exception ClassCastException if {@code listenerType} * doesn't specify a class or interface that implements - *java.util.EventListener
+ * {@code java.util.EventListener} * @exception NullPointerException if {@code listenerType} is {@code null} * * @see #getWindowListeners @@ -1991,10 +1991,10 @@ /** * Processes events on this window. If the event is an - *WindowEvent
, it invokes the - *processWindowEvent
method, else it invokes its - * superclass'sprocessEvent
. - *Note that if the event parameter is
null
+ * {@code WindowEvent}, it invokes the + * {@code processWindowEvent} method, else it invokes its + * superclass's {@code processEvent}. + *Note that if the event parameter is {@code null} * the behavior is unspecified and may result in an * exception. * @@ -2033,10 +2033,10 @@ * following occurs: *
addWindowListener
- * enableEvents
+ * {@code addWindowListener}
+ * Note that if the event parameter is null
+ *
Note that if the event parameter is {@code null} * the behavior is unspecified and may result in an * exception. * @@ -2082,10 +2082,10 @@ * following occurs: *
addWindowFocusListener
- * enableEvents
+ * {@code addWindowFocusListener}
+ * Note that if the event parameter is null
+ *
Note that if the event parameter is {@code null}
* the behavior is unspecified and may result in an
* exception.
*
@@ -2111,17 +2111,17 @@
/**
* Processes window state event occuring on this window by
- * dispatching them to any registered WindowStateListener
+ * dispatching them to any registered {@code WindowStateListener}
* objects.
* NOTE: this method will not be called unless window state events
* are enabled for this window. This happens when one of the
* following occurs:
*
WindowStateListener
is registered via
- * addWindowStateListener
- * enableEvents
+ * Note that if the event parameter is null
+ *
Note that if the event parameter is {@code null}
* the behavior is unspecified and may result in an
* exception.
*
@@ -2145,7 +2145,7 @@
/**
* Implements a debugging hook -- checks to see if
* the user has typed control-shift-F1. If so,
- * the list of child windows is dumped to System.out
.
+ * the list of child windows is dumped to {@code System.out}.
* @param e the keyboard event
*/
void preProcessKeyEvent(KeyEvent e) {
@@ -2176,21 +2176,21 @@
* automatically become always-on-top. If a window ceases to be
* always-on-top, the windows that it owns will no longer be
* always-on-top. When an always-on-top window is sent {@link #toBack
- * toBack}, its always-on-top state is set to false
.
+ * toBack}, its always-on-top state is set to {@code false}.
*
*
When this method is called on a window with a value of
- * true
, and the window is visible and the platform
+ * {@code true}, and the window is visible and the platform
* supports always-on-top for this window, the window is immediately
* brought forward, "sticking" it in the top-most position. If the
* window isn`t currently visible, this method sets the always-on-top
- * state to true
but does not bring the window forward.
+ * state to {@code true} but does not bring the window forward.
* When the window is later shown, it will be always-on-top.
*
*
When this method is called on a window with a value of
- * false
the always-on-top state is set to normal. The
+ * {@code false} the always-on-top state is set to normal. The
* window remains in the top-most position but it`s z-order can be
* changed as for any other window. Calling this method with a value
- * of false
on a window that has a normal state has no
+ * of {@code false} on a window that has a normal state has no
* effect. Setting the always-on-top state to false has no effect on
* the relative z-order of the windows if there are no other
* always-on-top windows.
@@ -2250,9 +2250,9 @@
* window. Some platforms may not support always-on-top windows, some
* may support only some kinds of top-level windows; for example,
* a platform may not support always-on-top modal dialogs.
- * @return true
, if the always-on-top mode is
+ * @return {@code true}, if the always-on-top mode is
* supported by the toolkit and for this window,
- * false
, if always-on-top mode is not supported
+ * {@code false}, if always-on-top mode is not supported
* for this window or toolkit doesn't support always-on-top windows.
* @see #setAlwaysOnTop(boolean)
* @see Toolkit#isAlwaysOnTopSupported
@@ -2265,8 +2265,8 @@
/**
* Returns whether this window is an always-on-top window.
- * @return true
, if the window is in always-on-top state,
- * false
otherwise
+ * @return {@code true}, if the window is in always-on-top state,
+ * {@code false} otherwise
* @see #setAlwaysOnTop
* @since 1.5
*/
@@ -2294,7 +2294,7 @@
/**
* Returns the child Component of this Window that will receive the focus
* when this Window is focused. If this Window is currently focused, this
- * method returns the same Component as getFocusOwner()
. If
+ * method returns the same Component as {@code getFocusOwner()}. If
* this Window is not focused, then the child Component that most recently
* requested focus will be returned. If no child Component has ever
* requested focus, and this is a focusable Window, then this Window's
@@ -2359,8 +2359,8 @@
}
/**
- * Gets a focus traversal key for this Window. (See
- * setFocusTraversalKeys
for a full description of each key.)
+ * Gets a focus traversal key for this Window. (See {@code
+ * setFocusTraversalKeys} for a full description of each key.)
*
* If the traversal key has not been explicitly set for this Window,
* then this Window's parent's traversal key is returned. If the
@@ -2419,10 +2419,10 @@
}
/**
- * Always returns true
because all Windows must be roots of a
+ * Always returns {@code true} because all Windows must be roots of a
* focus traversal cycle.
*
- * @return true
+ * @return {@code true}
* @see #setFocusCycleRoot
* @see Container#setFocusTraversalPolicy
* @see Container#getFocusTraversalPolicy
@@ -2433,10 +2433,10 @@
}
/**
- * Always returns null
because Windows have no ancestors; they
+ * Always returns {@code null} because Windows have no ancestors; they
* represent the top of the Component hierarchy.
*
- * @return null
+ * @return {@code null}
* @see Container#isFocusCycleRoot()
* @since 1.4
*/
@@ -2448,16 +2448,16 @@
* Returns whether this Window can become the focused Window, that is,
* whether this Window or any of its subcomponents can become the focus
* owner. For a Frame or Dialog to be focusable, its focusable Window state
- * must be set to true
. For a Window which is not a Frame or
+ * must be set to {@code true}. For a Window which is not a Frame or
* Dialog to be focusable, its focusable Window state must be set to
- * true
, its nearest owning Frame or Dialog must be
+ * {@code true}, its nearest owning Frame or Dialog must be
* showing on the screen, and it must contain at least one Component in
* its focus traversal cycle. If any of these conditions is not met, then
* neither this Window nor any of its subcomponents can become the focus
* owner.
*
- * @return true
if this Window can be the focused Window;
- * false
otherwise
+ * @return {@code true} if this Window can be the focused Window;
+ * {@code false} otherwise
* @see #getFocusableWindowState
* @see #setFocusableWindowState
* @see #isShowing
@@ -2497,16 +2497,16 @@
/**
* Returns whether this Window can become the focused Window if it meets
- * the other requirements outlined in isFocusableWindow
. If
- * this method returns false
, then
- * isFocusableWindow
will return false
as well.
- * If this method returns true
, then
- * isFocusableWindow
may return true
or
- * false
depending upon the other requirements which must be
+ * the other requirements outlined in {@code isFocusableWindow}. If
+ * this method returns {@code false}, then
+ * {@code isFocusableWindow} will return {@code false} as well.
+ * If this method returns {@code true}, then
+ * {@code isFocusableWindow} may return {@code true} or
+ * {@code false} depending upon the other requirements which must be
* met in order for a Window to be focusable.
*
* By default, all Windows have a focusable Window state of
- * true
.
+ * {@code true}.
*
* @return whether this Window can be the focused Window
* @see #isFocusableWindow
@@ -2521,25 +2521,25 @@
/**
* Sets whether this Window can become the focused Window if it meets
- * the other requirements outlined in isFocusableWindow
. If
- * this Window's focusable Window state is set to false
, then
- * isFocusableWindow
will return false
. If this
- * Window's focusable Window state is set to true
, then
- * isFocusableWindow
may return true
or
- * false
depending upon the other requirements which must be
+ * the other requirements outlined in {@code isFocusableWindow}. If
+ * this Window's focusable Window state is set to {@code false}, then
+ * {@code isFocusableWindow} will return {@code false}. If this
+ * Window's focusable Window state is set to {@code true}, then
+ * {@code isFocusableWindow} may return {@code true} or
+ * {@code false} depending upon the other requirements which must be
* met in order for a Window to be focusable.
*
- * Setting a Window's focusability state to false
is the
+ * Setting a Window's focusability state to {@code false} is the
* standard mechanism for an application to identify to the AWT a Window
* which will be used as a floating palette or toolbar, and thus should be
* a non-focusable Window.
*
- * Setting the focusability state on a visible Window
+ * Setting the focusability state on a visible {@code Window}
* can have a delayed effect on some platforms the actual
- * change may happen only when the Window
becomes
+ * change may happen only when the {@code Window} becomes
* hidden and then visible again. To ensure consistent behavior
- * across platforms, set the Window
's focusable state
- * when the Window
is invisible and then show it.
+ * across platforms, set the {@code Window}'s focusable state
+ * when the {@code Window} is invisible and then show it.
*
* @param focusableWindowState whether this Window can be the focused
* Window
@@ -2726,7 +2726,7 @@
/**
* @deprecated As of JDK version 1.1
- * replaced by dispatchEvent(AWTEvent)
.
+ * replaced by {@code dispatchEvent(AWTEvent)}.
*/
@Deprecated
public boolean postEvent(Event e) {
@@ -2876,22 +2876,22 @@
/**
* Writes default serializable fields to stream. Writes
- * a list of serializable WindowListener
s and
- * WindowFocusListener
s as optional data.
+ * a list of serializable {@code WindowListener}s and
+ * {@code WindowFocusListener}s as optional data.
* Writes a list of child windows as optional data.
* Writes a list of icon images as optional data
*
- * @param s the ObjectOutputStream
to write
- * @serialData null
terminated sequence of
- * 0 or more pairs; the pair consists of a String
- * and and Object
; the String
+ * @param s the {@code ObjectOutputStream} to write
+ * @serialData {@code null} terminated sequence of
+ * 0 or more pairs; the pair consists of a {@code String}
+ * and {@code Object}; the {@code String}
* indicates the type of object and is one of the following:
- * windowListenerK
indicating a
- * WindowListener
object;
- * windowFocusWindowK
indicating a
- * WindowFocusListener
object;
- * ownedWindowK
indicating a child
- * Window
object
+ * {@code windowListenerK} indicating a
+ * {@code WindowListener} object;
+ * {@code windowFocusWindowK} indicating a
+ * {@code WindowFocusListener} object;
+ * {@code ownedWindowK} indicating a child
+ * {@code Window} object
*
* @see AWTEventMulticaster#save(java.io.ObjectOutputStream, java.lang.String, java.util.EventListener)
* @see Component#windowListenerK
@@ -3029,16 +3029,16 @@
}
/**
- * Reads the ObjectInputStream
and an optional
+ * Reads the {@code ObjectInputStream} and an optional
* list of listeners to receive various events fired by
* the component; also reads a list of
- * (possibly null
) child windows.
+ * (possibly {@code null}) child windows.
* Unrecognized keys or values will be ignored.
*
- * @param s the ObjectInputStream
to read
+ * @param s the {@code ObjectInputStream} to read
* @exception HeadlessException if
- * GraphicsEnvironment.isHeadless
returns
- * true
+ * {@code GraphicsEnvironment.isHeadless} returns
+ * {@code true}
* @see java.awt.GraphicsEnvironment#isHeadless
* @see #writeObject
*/
@@ -3100,7 +3100,7 @@
/**
* This class implements accessibility support for the
- * Window
class. It provides an implementation of the
+ * {@code Window} class. It provides an implementation of the
* Java Accessibility API appropriate to window user-interface elements.
* @since 1.3
*/
@@ -3186,7 +3186,7 @@
* not changed.
*
* Note: If the lower edge of the window is out of the screen,
- * then the window is placed to the side of the Component
+ * then the window is placed to the side of the {@code Component}
* that is closest to the center of the screen. So if the
* component is on the right part of the screen, the window
* is placed to its left, and vice versa.
@@ -3289,7 +3289,7 @@
* Creates a new strategy for multi-buffering on this component.
* Multi-buffering is useful for rendering performance. This method
* attempts to create the best strategy available with the number of
- * buffers supplied. It will always create a BufferStrategy
+ * buffers supplied. It will always create a {@code BufferStrategy}
* with that number of buffers.
* A page-flipping strategy is attempted first, then a blitting strategy
* using accelerated buffers. Finally, an unaccelerated blitting
@@ -3318,13 +3318,13 @@
* is called, the existing buffer strategy for this component is discarded.
* @param numBuffers number of buffers to create, including the front buffer
* @param caps the required capabilities for creating the buffer strategy;
- * cannot be null
+ * cannot be {@code null}
* @exception AWTException if the capabilities supplied could not be
* supported or met; this may happen, for example, if there is not enough
* accelerated memory currently available, or if page flipping is specified
* but not possible.
* @exception IllegalArgumentException if numBuffers is less than 1, or if
- * caps is null
+ * caps is {@code null}
* @see #getBufferStrategy
* @since 1.4
*/
@@ -3334,8 +3334,8 @@
}
/**
- * Returns the BufferStrategy
used by this component. This
- * method will return null if a BufferStrategy
has not yet
+ * Returns the {@code BufferStrategy} used by this component. This
+ * method will return null if a {@code BufferStrategy} has not yet
* been created or has been disposed.
*
* @return the buffer strategy used by this component
@@ -3376,7 +3376,7 @@
/**
* Sets whether this Window should appear at the default location for the
* native windowing system or at the current location (returned by
- * getLocation
) the next time the Window is made visible.
+ * {@code getLocation}) the next time the Window is made visible.
* This behavior resembles a native window shown without programmatically
* setting its location. Most windowing systems cascade windows if their
* locations are not explicitly set. The actual location is determined once the
@@ -3386,8 +3386,8 @@
* "java.awt.Window.locationByPlatform" to "true", though calls to this method
* take precedence.
*
- * Calls to setVisible
, setLocation
and
- * setBounds
after calling setLocationByPlatform
clear
+ * Calls to {@code setVisible}, {@code setLocation} and
+ * {@code setBounds} after calling {@code setLocationByPlatform} clear
* this property of the Window.
*
* For example, after the following code is executed:
@@ -3397,7 +3397,7 @@
* boolean flag = isLocationByPlatform();
*
* The window will be shown at platform's default location and
- * flag
will be false
.
+ * {@code flag} will be {@code false}.
*
* In the following sample: *
- * The window will be shown at (10, 10) and@@ -3406,13 +3406,13 @@ * boolean flag = isLocationByPlatform(); * setVisible(true); *
flag
will be
- * false
.
+ * The window will be shown at (10, 10) and {@code flag} will be
+ * {@code false}.
*
- * @param locationByPlatform true
if this Window should appear
- * at the default location, false
if at the current location
- * @throws IllegalComponentStateException
if the window
- * is showing on screen and locationByPlatform is true
.
+ * @param locationByPlatform {@code true} if this Window should appear
+ * at the default location, {@code false} if at the current location
+ * @throws {@code IllegalComponentStateException} if the window
+ * is showing on screen and locationByPlatform is {@code true}.
* @see #setLocation
* @see #isShowing
* @see #setVisible
@@ -3430,9 +3430,9 @@
}
/**
- * Returns true
if this Window will appear at the default location
+ * Returns {@code true} if this Window will appear at the default location
* for the native windowing system the next time this Window is made visible.
- * This method always returns false
if the Window is showing on the
+ * This method always returns {@code false} if the Window is showing on the
* screen.
*
* @return whether this Window will appear at the default location
@@ -3509,8 +3509,8 @@
/**
* Determines whether this component will be displayed on the screen.
- * @return true
if the component and all of its ancestors
- * until a toplevel window are visible, false
otherwise
+ * @return {@code true} if the component and all of its ancestors
+ * until a toplevel window are visible, {@code false} otherwise
*/
boolean isRecursivelyVisible() {
// 5079694 fix: for a toplevel to be displayed, its parent doesn't have to be visible.
diff -r 30a1d677a20c -r 9dc631273af7 jdk/src/share/classes/javax/swing/JLabel.java
--- a/jdk/src/share/classes/javax/swing/JLabel.java Wed Jul 05 19:07:31 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/JLabel.java Tue Aug 13 15:49:37 2013 -0700
@@ -1185,14 +1185,13 @@
}
/**
- * Determine the bounding box of the character at the given
- * index into the string. The bounds are returned in local
- * coordinates. If the index is invalid an empty rectangle is
- * returned.
+ * Returns the bounding box of the character at the given
+ * index in the string. The bounds are returned in local
+ * coordinates. If the index is invalid, null
is returned.
*
* @param i the index into the String
- * @return the screen coordinates of the character's the bounding box,
- * if index is invalid returns an empty rectangle.
+ * @return the screen coordinates of the character's bounding box.
+ * If the index is invalid, null
is returned.
* @since 1.3
*/
public Rectangle getCharacterBounds(int i) {
diff -r 30a1d677a20c -r 9dc631273af7 jdk/test/java/awt/Focus/8013611/JDK8013611.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Focus/8013611/JDK8013611.java Tue Aug 13 15:49:37 2013 -0700
@@ -0,0 +1,111 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ @test
+ @bug 8013611
+ @summary Tests showing a modal dialog with requesting focus in frame.
+ @author Anton.Tarasov: area=awt.focus
+ @library ../../regtesthelpers
+ @build Util
+ @run main JDK8013611
+*/
+
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+import test.java.awt.regtesthelpers.Util;
+
+import java.awt.*;
+
+public class JDK8013611 extends JFrame {
+ static JTextField textField = new JTextField("text");
+ static JButton button1 = new JButton("button1");
+ static JButton button2 = new JButton("button2");
+ static Robot robot;
+
+ static JDialog dialog;
+ static JButton button3 = new JButton("button3");
+
+ public static void main(String[] args) {
+ robot = Util.createRobot();
+
+ JDK8013611 frame = new JDK8013611();
+ frame.setLayout(new FlowLayout());
+ frame.add(textField);
+ frame.add(button1);
+ frame.add(button2);
+ frame.pack();
+
+ dialog = new JDialog(frame, true);
+ dialog.add(button3);
+ dialog.pack();
+
+ textField.addFocusListener(new FocusAdapter() {
+ @Override
+ public void focusLost(FocusEvent e) {
+ dialog.setVisible(true);
+ }
+ });
+
+ button1.addFocusListener(new FocusAdapter() {
+ @Override
+ public void focusGained(FocusEvent e) {
+ button2.requestFocusInWindow();
+ }
+ });
+
+ frame.setVisible(true);
+
+ frame.test();
+ }
+
+ public void test() {
+ if (!testFocused(textField)) {
+ Util.clickOnComp(textField, robot);
+ if (!testFocused(textField)) {
+ throw new RuntimeException("Error: couldn't focus " + textField);
+ }
+ }
+
+ robot.keyPress(KeyEvent.VK_TAB);
+ robot.delay(50);
+ robot.keyRelease(KeyEvent.VK_TAB);
+
+ if (!testFocused(button3)) {
+ throw new RuntimeException("Test failed: dialog didn't get focus!");
+ }
+
+ System.out.println("Test passed.");
+ }
+
+ boolean testFocused(Component c) {
+ for (int i=0; i<10; i++) {
+ if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() == c) {
+ return true;
+ }
+ Util.waitForIdle(robot);
+ }
+ return false;
+ }
+}