Reputation: 317
I'm working with swing and I'm not able to change the JFrame in COMPONENTS area in WindowBuilder. I can only see the main frame. When I press a button I create a new Frame but I cant edit it with WindowBuilder.
frameMain.setVisible(false);
frameLogin = new JFrame("Login Admin");
frameLogin.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frameLogin.setSize(600, 400);
frameLogin.setLocationRelativeTo(null);
frameLogin.setVisible(true);
I WANT TO EDIT frameLogin in WindowBuilder, any solution? By creating a new JFrame in WindowBuilder it creates another class in other file.
Upvotes: 0
Views: 2296
Reputation: 317
I did this : In my view (frameMain) I declared this :
private loginFrameAdmin frameLoginA;
private loginFrameUser frameLoginU;
where loginFrameAdmin is a JFrame like this :
import javax.swing.JFrame;
public class loginFrameAdmin {
private JFrame frameLogin;
public loginFrameAdmin() {
frameLogin = new JFrame("Login Amministratore");
frameLogin.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frameLogin.setSize(600, 400);
frameLogin.setLocationRelativeTo(null);
frameLogin.setVisible(true);
}
}
Then in the same view (frameMain) I added a class :
public void adminPage() {
JOptionPane.showMessageDialog(null, "Login for admins");
frameMain.setVisible(false);
frameLoginA = new loginFrameAdmin();
}
And now I'm able to edit my JFrame, thanks to @kalsowerus
Upvotes: 1