Originally posted by Meghana Reddy:
I want to design this in a way such that all the events generated by LoginFrame.java should be handled in another class called LoginFrameEventHandler.java which implements all the corresponding event listeners.
Ex: JButton submit = new JButton();
submit.addActionListener(new LoginFrameEventHandler());
Now when the submit button is pressed, the event is fired properly, but I am not able to get the reference to the textfield and the password field of LoginFrame.java in the LoginFrameEventHandler.java.
Well you could have your listener accept those two fields in its constructor, so something like:
JButton submit = new JButton();
submit.addActionListener(new LoginFrameEventHandler(userField, passField));