Multi Screen design using java swing

Hi,

I am designing a Java desktop application in which a main screen will contain 5 flash buttons.If I click one button a new form gets created and displayed.I can minimize my this window and create another window,if I click the same button.

My point here is:if I click the same button and if the window is already opened,it should not create a new window ,just display already opened window.

My application should have a mechanism that if I click any button,it should check if already that window is opened or not.

Example:

private void btnOneActionPerformed(java.awt.event.ActionEvent evt) {

MyFirstForm mf=new MyFirstForm();

mf.setVisible(true);

this.dispose();

}

private void btnTwoActionPerformed(java.awt.event.ActionEvent evt) {

MySecondForm ms=new MySecondForm();

ms.setVisible(true);

this.dispose();

}

private void btnThreeActionPerformed(java.awt.event.ActionEvent evt) {

MyThirdForm mt=new MyThirdForm();

mt.setVisible(true);

this.dispose();

}

like this five buttons and five event actions are there.

I can minimize First Form and again click the Button One to recreate it again.

If form First is already opened i should not create it again; just restore it if minimized.

Thanks in advance.

Bharat

[1364 byte] By [bharatkadaa] at [2007-11-27 4:02:48]
# 1
hey,first thought....add a WindowListener or a WindowStateListener to your frames. with those you can check the state of the window.
izziieea at 2007-7-12 9:07:33 > top of Java-index,Desktop,Core GUI APIs...
# 2
Thanks i got it
bharatkadaa at 2007-7-12 9:07:33 > top of Java-index,Desktop,Core GUI APIs...