Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>EDIT, </p> <ul> <li><p>contents of <code>JWindow</code> is accesible only if its parent is displayed on the screen</p></li> <li><p>for editable and accesible contents use un_decorated <code>JDialog</code> instead of <code>JWindow</code>, jDialog doesn't caused non_accesible contents, </p></li> <li><p>reason why ..., I can't explain, not undestand why, no way in this moment, the API says me nothing about caused accesible, editable ...</p></li> </ul> <p>. . .</p> <pre><code>1. Why JTextField is uneditable in JWindow and how could i let it able to edit? </code></pre> <p>really don't know </p> <pre><code>import java.awt.*; import javax.swing.*; public class WindowTest { private JFrame frame; public JPanel createContentPane() { JTextField text = new JTextField("Whatewer"); JPanel panel = new JPanel(); panel.add(text); createAndShowWindow(); return panel; } void createAndShowGUI() { frame = new JFrame("Window Test"); frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); frame.setContentPane(createContentPane()); frame.setLocation(50, 50); frame.pack(); frame.setVisible(true); } private void createAndShowWindow() { JTextField text = new JTextField("Whatewer"); JWindow win = new JWindow(frame); win.setLayout(new GridLayout(0, 1)); win.add(text); win.pack(); win.setLocation(150, 50); win.setVisible(true); } public static void main(String args[]) { EventQueue.invokeLater(new Runnable() { public void run() { new WindowTest().createAndShowGUI(); } }); } } </code></pre> <p>EDIT</p> <pre><code>Yes, both are editable, and i wannt only JWindow to be displayed. Thanks!! </code></pre> <ul> <li><p>by default JWindow required JFrame for correct workaround</p></li> <li><p>nobody tell that this JFrame must be visible (valid for GUI), then remove these code lines from <code>frame.setDefaultClose</code>.... including <code>frame.setVisible(true);</code> from my example</p></li> <li><p>in this form current JVM instance never gone from RAM, untill your PC restarted or swith off, you have to add separated exit <code>JButton</code> with code line <code>System.exit(0)</code> inside <code>ActionListener</code></p></li> </ul>
 

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