Article View: borland.public.jbuilder.java.swing
Article #9747Re: To thread or not to thread?
From: John P. McGrath
Date: Sat, 15 Jan 2000 00:00
Date: Sat, 15 Jan 2000 00:00
28 lines
1601 bytes
1601 bytes
On Fri, 14 Jan 2000 22:09:48 -0800, BS wrote: > I'm writing an app that is using a series of panels. Each > panel contains a set of buttons, etc... When a certain > button is pressed the current panel is set invisible while > the next one is set visible. > > My problem is: When I click on a button it seems that the > actions (ie. connect to a database) are taking over resources > and the repaint message is delayed causing certain items from > the previous panel to be seen along with buttons on the next > panel while the action is being performed. > > My question is: Should the actions that are to be performed > be run in a separate thread or is there a function similar to > Delphi's Application.ProcessMessages()? It sounds like you need to perform the actions in a separate thread. If the action is performed within a button's action method, then it is being performed in the event dispatch thread. Painting also happens in the event dispatch thread, so painting will not occur until you return from the button's action method. -- John P. McGrath <JPMcGrath@fast.net> <jpm@nscs.fast.net>
Technical Details
Message-ID:
<MPG.12ea04732c47e8ed989736@forums.borland.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<85oo41$9ov24@bornews.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,e10483a2298b307b X-Google-Attributes: gid111d45,public From: John P. McGrath <JPMcGrath@fast.net> Subject: Re: To thread or not to thread? Date: 2000/01/15 Message-ID: <MPG.12ea04732c47e8ed989736@forums.borland.com> X-Deja-AN: 572908455 References: <85oo41$9ov24@bornews.borland.com> Organization: Another Netscape Collabra Server User Newsgroups: borland.public.jbuilder.java.swing