Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to close jdialog without any event?

Posted on 2002-03-03
3
Medium Priority
?
640 Views
Last Modified: 2008-01-09
I'm showing JDialog and after some time(say thread.sleep(1000), dialog should dispose automatically.
 is their any way to achieve it?

Thanks,
0
Comment
Question by:vibhav
[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
  • 2
3 Comments
 
LVL 3

Accepted Solution

by:
daitt earned 90 total points
ID: 6837581
Create another thread and close the dialog in that thread.
Or you can use class Timer.
class Closer extends Thread{
int time;
JDialog target;
public Closer(int time, JDialog target){
this.time = time;
this.target = target;
start();
}
public void run(){
try{
sleep(time);
}
catch (InterruptedException e){
e.printStackTrace();
}
target.setVisible(true);
target.dispose();
}
}
0
 
LVL 1

Expert Comment

by:Moondancer
ID: 6956320
Please click the link below to manage all your open and locked questions here needing your response and attention.
http://www.experts-exchange.com/jsp/memberProfile.jsp?mbr=vibhav&showQHistory=true
Moondancer - EE Moderator
0
 
LVL 1

Expert Comment

by:Moondancer
ID: 6960024
Please tell us why you graded this with a "B" grade versus "A".  The points to you are the same, but the expert points which flow are a direct result of the grade you assigned.  We ALWAYS appreciate knowing why grades less than "A" are given.  If you found additional information outside of this question thread, we'd also like to know that since it adds value to this item as it has moved to our PAQ and can help others.  
Thanks, listening further.
Moondancer - EE Moderator
0

Featured Post

Build and deliver software with DevOps

A digital transformation requires faster time to market, shorter software development lifecycles, and the ability to adapt rapidly to changing customer demands. DevOps provides the solution.

Question has a verified solution.

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

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
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…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses

715 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