This form is opened by pressing a button. I try to add a textfield component to textfield , but it is not displayed. Tried already for this form methods revalidate() and repaint() , but the component is still not displayed.
class Better implements ActionListener{ public void actionPerformed (ActionEvent e){ form2.setDefaultCloseOperation(EXIT_ON_CLOSE); form2.setBounds(300,200,600,450); form2.setLayout(null); form2.getContentPane(); form2.add(btn6); form2.add(btn7); form2.add(tf1); tf1.setLocation(200,150); form2.revalidate(); form2.repaint(); btn6.setSize(135,50); btn6.setLocation(450,360); btn7.setSize(134,50); btn7.setLocation(0,360); form1.setVisible(false); form2.setVisible(true); }