🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.swing
Article #8959

Re: dialog

#8959
From: John P. McGrath
Date: Thu, 15 Jun 2000 00:00
34 lines
1749 bytes
On Thu, 15 Jun 2000 11:23:59 +0200, Joachim =?iso-8859-1?Q?Intre=DF?= 
wrote:

> a have create a method that is run for a long time. I will
> show a wait dialog in this time.  The dialog starts, but it
> isn't show properly on the screen.  If the method ends after
> a long time, the dialog is shown properly.

It looks like you are running the method from the event dispatch thread.  
This is what would happen if you call the method from an event listener 
attached to a button, menu item, or other UI component.

Painting also happens on the event dispatch thread, so your UI will not 
be painted until some time after you return from the event listener.

What you need to do is to run your method in a separate thread.  The 
following link provides information using multiple threads with Swing:

    http://java.sun.com/docs/books/tutorial/uiswing/misc/threads.html

The following gives more general information about threads:

    http://java.sun.com/docs/books/tutorial/essential/threads/index.html

These are both part of "The Java Tutorial", which is a very good place to 
learn about many Java features.  You may want to start at the top of the 
Tutorial at:

    http://java.sun.com/docs/books/tutorial/

-- 
John P. McGrath
<JPMcGrath@fast.net>
<jpm@nscs.fast.net>
Technical Details
Message-ID: <MPG.13b36d3a4eedd9709899d2@forums.borland.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <3948A0AE.11376E5B@atb-potsdam.de>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,c9bbf77e2343ca81
X-Google-Attributes: gid111d45,public
From: John P. McGrath <JPMcGrath@fast.net>
Subject: Re: dialog
Date: 2000/06/15
Message-ID: <MPG.13b36d3a4eedd9709899d2@forums.borland.com>
X-Deja-AN: 635177279
References: <3948A0AE.11376E5B@atb-potsdam.de>
Organization: Another Netscape Collabra Server User
Newsgroups: borland.public.jbuilder.java.swing