i can open a form or another forms when button is clicked in netbeans.
such as the following code
private void button1ActionPerformed(java.awt.event.ActionEvent evt) {
frame1 fr = new frame1();
desktop.add(fr);
fr.setVisible(true);}
but i want to control that is current form is open or close? if current form is open then when i click same button not open current form again until its closed the same form. how can i make it? there is some methods like isclosed(), isDisplayable(), but i dont khow how can i use these? please give me advice.
You could use Boolean variables to determine whether or not the allowance of opening a frame.
example:
In your main frame code where you open the secondary frame you can do this
So now the second frame is open, and now it will only let you open it if allow_ is true.
Now when you close the second frame you do this:
Now the second frame is closed, and will now be allowed to be opened once again.