Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

open JFrame from JDialog  RSS feed

 
Antonio Plastini
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
This is my problem: a JFrame opens a JDialog that, in turn, opens another JFrame. Because of the nature of JDialog I have to hide it temporary.
Now what happens is that the execution of JDilog's code goes on, even if the second JFrame is still showing.
How can I stop this execution?

Thanks in advance
 
Nicky Eng
Ranch Hand
Posts: 378
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
in the actionPerformed for JDialog's button(the button where you click and second JFrame pop up), add the following code:

setVisible(false);

so when you click on the button, the JFrame will pop up, and the JDialog will setVisible to false and it will stop its execution.

i also doing a project using this way...but i have dilemma with second JFrame pop up and i want it to be the active JFrame, and the 1st JFrame i cannot click unless i finish my second JFrame function.

if you know that problem,hope you give me a msg. thanks.

all the best.
 
Antonio Plastini
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Nicky,
yes, the execution of JDilog stops but exactly when I hide the jdialog (inside the actionPerformed) the first JFrame re-starts with his execution so my data becomes inconsistent...

About your problem, you need a modal JFrame... ugly issue :-)
 
Nicky Eng
Ranch Hand
Posts: 378
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi...

oh? the 1st JFrame will re-start ?? hm...i'm not sure about that.

we can takes modal to a JFrame constructor???

i try to do it in constriuctor , but still cannot. now going to check for any method for modal...thanks.

p/s: why you wanna hide jdialog in this case you want it to stop execution as you said in the firs post...

[ July 14, 2005: Message edited by: Nicky Eng ]
-----------------
after one minutes i post, i got some method and applied it, but failed. i try isActive(), isFocused()..i think focusableWindowState is not use for JFrame. haiz...

by the way, how old are you ?
[ July 14, 2005: Message edited by: Nicky Eng ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!