?
Solved

Jdialog doesn't hide as I click OK button

Posted on 2003-03-18
10
Medium Priority
?
922 Views
Last Modified: 2008-03-04
here is my Code

dialog=new JDialog(this,"",true);
....
dialog.show();
dialog.hide();
dialog.dispose();
....
if (isOK) {             // OK was typed
...here is long runing query..........


}
only after query finishes, jdialog dissapers. no matter where I place hide or dispose.
even inside actionperformed block. what does it mean? can I somehow handle
the situation? ( remove jdialog at once?)? I want to show a new dialog with clock
calculating query time

Thanks
0
Comment
Question by:kako
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
10 Comments
 
LVL 35

Expert Comment

by:TimYates
ID: 8159380
dialog.hide();
Thread.yield() ;
...
0
 
LVL 35

Expert Comment

by:TimYates
ID: 8159384
Swing runs in a seperate thread to your processing, so if you do something processor-hungry, calling Thread.yield() allows the Swing thread to do its repainting :-)
0
 

Author Comment

by:kako
ID: 8159442
what you say seems to be quite reasonable, but not helps :)
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:kako
ID: 8159443
what you say seems to be quite reasonable, but not helps :)
0
 
LVL 35

Expert Comment

by:TimYates
ID: 8159629
It still doesn't vanish?

Can you post the code which calls the dialog, and the dialog code?
0
 

Author Comment

by:kako
ID: 8159690
it's huge :(

here is part of code

void real_actionPerformed() {
   int sizeX=400, sizeY=300;
   inffo = new JDialog(this,"",true);
   inffo.setResizable(false);
   inffo.getContentPane().setLayout(new XYLayout());
   inffo.setSize(new Dimension(sizeX,sizeY));
   inffo.setLocation((ssx+20-sizeX)/2,(ssy-sizeY)/2);
         inffo.getContentPane().add(header,new XYConstraints( 135, 8, 200, 20));
         inffo.getContentPane().add(month_start,new XYConstraints( 20, 35, 100, 20));
         inffo.getContentPane().add(year_start,new XYConstraints( 125, 35, 60, 20));
         inffo.getContentPane().add(month_end,new XYConstraints( 215, 35, 100, 20));
         inffo.getContentPane().add(year_end,new XYConstraints( 320, 35, 60, 20));
         month_start.setSelectedIndex(Integer.parseInt(curmonchar)-1);
         month_end.setSelectedIndex(Integer.parseInt(curmonchar)-1);
         year_start.setSelectedIndex(Integer.parseInt(curyearchar)-2003);
         year_end.setSelectedIndex(Integer.parseInt(curyearchar)-2003);
         inffo.getContentPane().add(sruli,new XYConstraints( 20, 70, 100, 20));
    buttons[OKindex].setRolloverEnabled(false);
    buttons[OKindex].setBorderPainted(true);
    buttons[CANCELindex].setRolloverEnabled(false);
    buttons[CANCELindex].setBorderPainted(true);
    inffo.getContentPane().add(buttons[OKindex], new XYConstraints( 40, sizeY-70, 50, 30));
    inffo.getContentPane().add(buttons[CANCELindex], new XYConstraints( sizeX-95, sizeY-70, 50, 30));
    inffo.show();
    inffo.hide();
    Thread.yield();
    if (isOK) {

.............queryes.........................
}
0
 
LVL 35

Accepted Solution

by:
TimYates earned 500 total points
ID: 8159866
Have you tried using

 setVisible( false )

instead of hide() ?

Hide is a deprecated method :-/
0
 

Author Comment

by:kako
ID: 8159950
no :(

I dont understand why I can't hide this jdialog
BEFORE processor-hungry query starts?
0
 

Author Comment

by:kako
ID: 8164504
As I guess, I need something like this
suspend executing program and
"preccess windows messages"

but how do it in java?
0
 

Expert Comment

by:CleanupPing
ID: 9058621
kako:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Suggested Courses
Course of the Month8 days, 1 hour left to enroll

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question