Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The <a href="http://docs.oracle.com/javase/7/docs/api/java/awt/Window.html#isFocusableWindow%28%29" rel="nofollow noreferrer">specification</a> says about <code>isFocusableWindow()</code> as below (I added the numbering to outline the points):</p> <blockquote> <p>public final boolean <strong><em>isFocusableWindow()</em></strong></p> <p>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. <strong>For a Window which is not a Frame or Dialog to be focusable,</strong></p> <p>i) <strong>its focusable Window state must be set to true,</strong></p> <p>ii) <strong>its nearest owning Frame or Dialog must be showing on the screen,</strong></p> <p>iii) <strong>and it must contain at least one Component in its focus traversal cycle.</strong></p> <p><strong><em>If any of these conditions is not met, then neither this Window nor any of its subcomponents can become the focus owner.</em></strong></p> </blockquote> <p>As you can see, your code doesn't meet the second rule, so your <code>JWindow</code> is not focusable. You need to have a <code>JDialog</code> or <code>JFrame</code> visible on the screen and then you can wrap it with a <code>JWindow</code>:</p> <pre><code>new JWindow(frame); </code></pre> <p>Or you may use <code>JDialog</code> or <code>JFrame</code> directly instead of <code>JWindow</code>. If you don't want the window to be decorated, just call <a href="http://docs.oracle.com/javase/7/docs/api/java/awt/Frame.html#setUndecorated%28boolean%29" rel="nofollow noreferrer"><code>Frame.setUndecorated(true)</code></a> or <a href="http://docs.oracle.com/javase/7/docs/api/java/awt/Dialog.html#setUndecorated%28boolean%29" rel="nofollow noreferrer"><code>Dialog.setUndecorated(true)</code></a>.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload