T
T
The_XXI2021-04-14 19:07:20
Java
The_XXI, 2021-04-14 19:07:20

How to disable form reopening?

I am using Java Swing.
In a form I have a button that opens another form.
How do I check if the form is open. can't you open it again?

addClientButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                InsertClientForm insertClientForm = new InsertClientForm("","Добавить клиента");
                //if (!insertClientForm.isDisplayable()) {
                    insertClientForm.setVisible(true);
                    insertClientForm.pack();
                //}
            }
        });

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Krokochik, 2021-12-06
@Krokochik

Before opening the form, it is necessary to check the Boolean variable cha after opening, change its value

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question