I'm working on a program with multiple JMenu Items that correspond to different user needs. I've assigned the respectable actions to them in my main frame. My problem is that the EditUsers Dialog is looping forever the previous JDialog(AddUserDialog, which is working properly and responds to being clicked, working as intended), therefore resulting in a freeze and termination from Eclipse. I'd like to thank any kind soul in advance that will help me in any way possible.
public class MainFrame extends JFrame implements ActionListener{
//------------------all variables and values have been assigned, JMenu Items are the focus------------
users = new JMenu("Users");
menuBar.add(users);
addUsers = new JMenuItem("Add User");
users.add(addUsers);
addUsers.addActionListener(this);
editUsers = new JMenuItem("Edit User");
users.add(editUsers);
editUsers.addActionListener(this);
auditUsers = new JMenuItem("Audit User");
users.add(auditUsers);
auditUsers.addActionListener(this);
public void actionPerformed(ActionEvent ae) {
// TODO Auto-generated method stub
//example for ActionListener in the first JMenuItem, working
if(ae.getSource() == interfaceOpt) {
JOptionPane.showMessageDialog(null, "Test");
System.out.println("Test");
}
//working
else if(ae.getSource()==sql){
System.out.println("Test1");
}
//working
else if(ae.getSource()==addUsers) {
try {
AddUserDialog addDialog=new AddUserDialog();
addDialog.setModalityType(ModalityType.APPLICATION_MODAL);
addDialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
}catch(Exception ex) {
ex.printStackTrace();
}
System.out.println("Test2");
}
-------------------------------------HERE IS THE ISSUE------------------------------------------
//not working, forever-looping the AddUserDialog class
else if(ae.getSource()==editUsers) {
try {
EditUsers editDialog=new EditUsers();
editDialog.setModalityType(ModalityType.APPLICATION_MODAL);
editDialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
}catch(Exception ex) {
ex.printStackTrace();
}
System.out.println("Test3");
}
My Screenshots for context (JMenu Users):

And lastly I just have a CPU stuttering when I try to run the Edit User Option. (Therefore no screenshot)
Currently I am working with the class AddUserDialog:
public class AddUserDialog extends JDialog implements ActionListener{
//a bunch of attributes
//do stuff
public AddUserDialog(){
//construct staff
}
}
The EditUsers class:
public class EditUsers extends AddUserDialog implements ActionListener{
//do stuff
public EditUsers{
//construct stuff
}
}
NOTE: The classes work properly on their own. If people are interested I'll share the contents of both classes and give a general glimpse on the purposes of my program.
