boolean flag = true;
public void run(){
// some code
loginButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
flag = false;
// Some code
}
});
while(flag){}
}
I am using while loop till the actionListener is invoked which I think is silly perhaps. Please let me know if this can be done in more efficient way.