The Artima Developer Community
Sponsored Link

Java Answers Forum
Waiting Dialog

2 replies on 1 page. Most recent reply: Feb 5, 2004 11:59 PM by Matthias Neumair

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 2 replies on 1 page
Matthias Neumair

Posts: 660
Nickname: neumi
Registered: Sep, 2003

Waiting Dialog Posted: Feb 4, 2004 2:01 AM
Reply to this message Reply
Advertisement
When I start a longer operation, I want to open a "plese wait" dialog window.

I have the following problem: The dialog opens, but remains empty.
Only when the import tourint is finished, the components get drawed.

I tried something like this:
dlg = new MyDialog (parentFrame, notModal, ...);
dlg.show();
doImport();
dlg.setCloseButtonActive(true); //resets mousepointer, enables input components


mahashankar sarangapani

Posts: 7
Nickname: greatmaha
Registered: Feb, 2004

Re: Waiting Dialog Posted: Feb 5, 2004 10:25 PM
Reply to this message Reply
Hi mathies

you can use one class that should extends dialog and runnable. Through this thread you need make this to sleep
it. Befour enter in you application you should make an instance of this dialog thread. After you have finished you should make this thead to null.
if you need further clarification please contact me.

Matthias Neumair

Posts: 660
Nickname: neumi
Registered: Sep, 2003

Re: Waiting Dialog Posted: Feb 5, 2004 11:59 PM
Reply to this message Reply
I first tried something like that.
The problem was, that the runnable dialog must not be associated with the main form.
Problem: I still can click in the main form.

So I worked the other way around:
I created a class extending the Thread class and put the import routine in this class. When the import routine is finished, it closes the dialog and I let the main program preceed.
It just works fine.

One other thing.
The dialog uses a JScrollPane containing a JTextArea to display the import routine's log messages.

I want the JScrollPane to follow the last line of the JTextArea. If a new line is added, it should scroll down.
What is the most effective way to do this?
I would prefer not using font metrics or something like that (but if there is no other way ... ).

Flat View: This topic has 2 replies on 1 page
Topic: How to make a JAR file? Previous Topic   Next Topic Topic: How to make JPanel scrollable?

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use