What I need to do is to prompt the user with a username and password (authentication is done locally) and if it checks out, the user would then be able to access the main program body.
public static void main(String[] args){
//String input = JOptionPane.showInputDialog("Enter password to continue: ");
//input2 = Integer.parseInt(input);
// followed by the creation of the main frame
new Cashier3();
Cashier3 frame = new Cashier3();
frame.setTitle("CASHIER 2");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
is there any quick way to go about doing this?
You can simply add a static block to your program where you will do your authentication, this static block is always executed before the main method. If the user is not valid go with
to exit the program. Else the program will start execution as usual.
Here is one sample program to give you some idea :