Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-24-2008, 03:31 PM
hannehomuth's Avatar
Member
 
Join Date: Jul 2008
Location: Sommerfeld (Brandenburg, Germany)
Posts: 35
hannehomuth is on a distinguished road
[SOLVED] Application should wait until a Dialog closes
Hi Forum,

I have such a silly question, and I think it will be documented anywhere but I did not find anything. I have a JDialog class and I want that my application should wait to execute until this Dialog closes or set any variable to true. I think this is not so hard but I can't get along with that. Here Some Code

Code:
public class ConfigurationEditView extends javax.swing.JDialog{ ... ... ... public ConfigurationEditView(boolean first) { super(new JFrame(), false); initComponents(); } public static void showDialog() { Runnable view = new Runnable() { public void run() { ConfigurationEditView cfgView = new ConfigurationEditView(true); cfgView.setVisible(true); cfgView.toFront(); } }; Thread nThread = new Thread(view); nThread.start(); //SwingUtilities.invokeLater(view); } ... ... ... }
And here the call

Code:
ConfigurationEditView.showDialog();
Can somebody give me a good example that my application (GUI App) not go on until the call
ConfigurationEditView.showDialog();
has returned.

I've tried with a boolean variable in a while loop but that also did'nt work.

Thx for suggestions
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 07-24-2008, 03:44 PM
Member
 
Join Date: Jul 2008
Posts: 31
skaspersen is on a distinguished road
Code:
public static void showDialog() { cfgView = new ConfigurationEditView(true); cfgView.setModal(true); cfgView.setVisible(true); System.out.println("Will not display until dialog closed"); }
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 07-24-2008, 03:51 PM
hannehomuth's Avatar
Member
 
Join Date: Jul 2008
Location: Sommerfeld (Brandenburg, Germany)
Posts: 35
hannehomuth is on a distinguished road
Thank you, it works.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
What is the execution path of wait() and notify() ? AegisCruiser Threads and Synchronization 1 04-23-2008 07:16 PM
How to use sleep() to wait for a while Java Tip java.lang 0 04-09-2008 07:32 PM
Launching an application from another application using thread Java Tip Java Tips 0 02-16-2008 10:29 PM
Middle Click Closes Tab Eclipse Plugin 1.0.0 JavaBean Java Announcements 0 10-20-2007 06:59 PM


All times are GMT +3. The time now is 07:48 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org