i've tried searching Stack Overflow and Code Ranch but with no luck with my query. I'll try and make it as simple and straight forward as possible. What i'm trying to do is have a login page that when it's clicked it checks the username against what i've coded and if it's right have it dispose of that JFrame and go onto another JFrame. Can anyone point me in the right direction?
button.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (userTextField.equals(userString)){
frame.dispose();
new SecondFrame();
}
}
});
Where button is the JButton, userTextField is the JTextField, userString is the String where the username is stored and SecondFrame being the JFrame I want it to move to when the JButton is selected
EDIT
public SecondFrame() {
centerPiece.setLayout(new net.miginfocom.swing.MigLayout());
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setSize(500, 525);
f.setVisible(true);
f.setLocationRelativeTo(null);
If you want more of it let me know