I have a Jwindow, and when I added a Jtextfield to it, the textfield became uneditable.
JWindow window = new JWindow();
window.setBounds(400, 100, 700,500);
window.setVisible(true);
window.setLayout(null);
JTextField text = new JTextField();
text.setBounds(300, 300, 150, 30);
text.setEditable(true);
window.getContentPane().add(text);
But when I tried to use Jframe as Jwindow's owner, the textfield was now editable, but the frame showed up together with the jwindow :
JFrame frame = new JFrame();
frame.setVisible(true);
JWindow window = new JWindow();
window.setBounds(400, 100, 700,500);
window.setVisible(true);
window.setLayout(null);
JTextField text = new JTextField();
text.setBounds(300, 300, 150, 30);
text.setEditable(true);
window.getContentPane().add(text);
So, I have 2 questions :
- Why JTextField is uneditable in JWindow and how could I make it editable?
- What is the main purpose of using JFrame as JWindow's border?