tags:

views:

16

answers:

1

I am a beginner in java swing. I have just created my first login screen using netbean. I like to ask after my actionPerformed if say login successfully. How do i actually go to the next screen? As in coding wise how should i code or netbeans got something build in for this

A: 

You should have a new class that extends Jframe called something appropriate (MainWindow maybe) that gets created when the user enters the correct password, so probably in the eventListener code for the button

if (usernameAndPasswordCorrect()) {
    loginWindow.setVisible(false);
    loginWindow.dispose();
    MainWindow w = new MainWindow();
    w.setVisible(true);
}
else {
    JOptionPane.showMessageDialog(loginWindow, "Incorrect login information. Try again.");
}

Or something like that.

David Watson