galera criei uma janela com um botão q ao clicar fecha e abre outra porem a segunda janela nao ta aparecendo na posição e no tamanho correto alguém pode me ajudar?
package PL;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
public class Janelas{
private JFrame janela1 = new JFrame("Cadastro");
private JFrame janela2 = new JFrame("Dados");
private JButton enter;
private JButton exit;
public Janelas() {
Janela_1();
}
public void Janela_1() {
this.janela1.setSize(500,500);
componentes_j1();
this.janela1.add(enter);
this.janela1.setLayout(null);
this.janela1.setLocationRelativeTo(null);
this.janela1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.janela1.setVisible(true);
}
public void Janela2() {
this.janela2.setSize(500,500);
//this.janela2.setLayout(null);
this.janela2.setLocationRelativeTo(null);
this.janela2.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.janela2.setVisible(true);
}
public void componentes_j1() {
enter= new JButton("Enter");
enter.setBounds(10,10,80,50);
enter.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
janela1.setVisible(false);
janela2.setVisible(true);
}
});
}
}