Results 1 to 4 of 4
- 01-27-2010, 10:10 AM #1
diapose the child frame if already opened or block to open a new one
how can i check whether a Jframe is opened or not
on clicking a button a new frame is pop up and some function that's ok but i clicked the same button the same frame is opened again again on clicking the same button how can i block this means if already opened
Thanks in advance
- 01-28-2010, 12:38 AM #2Senior Member
- Join Date
- Aug 2009
- Pittsburgh, PA
- Rep Power
The simplest (if not best) answer is to extend the Frame by adding a boolean variable.
Initialize it to false. When the Frame is opened, set it true.
If the variable is true, do not open the window.
Do you want instead to use a modal JDialog here instead of a JFrame? That would prevent any action from occurring on the main GUI until the dialog has been completely dealt with. Or if you must use a non-modal dialog, you could disable the button, and attach a listener to the dialog to see when it closes, and then re-enable the button.
- 01-28-2010, 05:13 AM #4
- By mravihpcl in forum New To JavaReplies: 0Last Post: 03-23-2009, 04:19 PM
- By ravian in forum Advanced JavaReplies: 6Last Post: 01-30-2008, 02:05 PM
- By Java Tip in forum Java TipReplies: 0Last Post: 01-25-2008, 06:50 PM
- By Java Tip in forum Java TipReplies: 0Last Post: 12-04-2007, 11:11 AM
- By sandeepspatil in forum Advanced JavaReplies: 1Last Post: 08-02-2007, 01:51 PM