Reputation: 227
I have a JFrame
class and it was made in the design section on Netbeans. I am trying to make a log in button that takes closes the current frame and opens another, is there anyway I can do that?
I have tried:
JFrame frame = new JFrame();
But I want it to be editable in the design section!
Upvotes: 20
Views: 275758
Reputation: 4132
This link works with me: video
The answer posted before didn't work for me until the second click
So what I did is Directly call:
new NewForm().setVisible(true);
this.dispose();//to close the current jframe
Upvotes: 6
Reputation: 634
new SecondForm().setVisible(true);
You can either use setVisible(false)
or dispose()
method to disappear current form.
Upvotes: 8
Reputation: 11
JFrame.setVisible(true);
You can either use setVisible(false)
or dispose()
method to disappear current form.
Upvotes: 1
Reputation: 1386
Double Click the Login Button in the NETBEANS or add the Event Listener on Click Event (ActionListener)
btnLogin.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e) {
this.setVisible(false);
new FrmMain().setVisible(true); // Main Form to show after the Login Form..
}
});
Upvotes: 24