Article View: borland.public.jbuilder.java.swing
Article #7577Re: I need a window which is modal
From: Rick Ingham
Date: Sat, 20 Jan 2001 03:01
Date: Sat, 20 Jan 2001 03:01
65 lines
3962 bytes
3962 bytes
I don't think a Dialog box stops other "processes" or threads other than the one making the dialog visible, does it? I would hope it doesn't stomp on all the other threads. This could kill background processing and network activity creating timeout disconnects and such. I'm curious if anyone else has suggestions on improvements to bring this closer to Dialog behavior. "HABA" <The.HABA@t-online.de> wrote in message news:3a68bcad_2@dnews... > thanks for your help, > > but i need a real modal jwindow which stops all other prozesses > > > "Rick Ingham" <rdingham@home.com> schrieb im Newsbeitrag > news:948o7v$nnm5@bornews.inprise.com... > > This made me curious enough, I just had to figure it out. Here is both a > ModalWindow and ModalFrame that extend JWindow and JFrame. > > > > Once you invoke show() or setVisible(true), the calling thread will block > in a thread wait, so make sure you have an action on the > > window that will invoke hide() or setVisible(false) to unblock and > notify() the original thread. > > > > "Rick Ingham" <rdingham@home.com> wrote in message > news:948gf1$nu85@bornews.inprise.com... > > > Sorry, I keep forgetting to bring home a code snippit. > > > > > > After I opened my big mouth, I realized mine is only a way to make the > thread modal. It pauses the thread calling > > setVisible(true) > > > or show() putting it into a thread wait(). Then an action event of some > kind within the window will do a notify() to rekindle the > > > sleeping thread. That's only part of the modal behavior of a Dialog. > > > > > > It doesn't make the parent window unavailable or disabled, nor does it > force the pseudo dialog window to come to the front when > > any > > > of the parent hierarchy is selected. > > > > > > I think this can be done by registering a FocusListener with each of the > parent components and calling toFront if focusGained() is > > > invoked while the modal window is visible. > > > > > > If you still need more, I'll try to put something like this together as > an example for you. > > > "Torsten Welches" <torsten.welches@who.cares.netcologne.de> wrote in > message news:3a669326$1_2@dnews... > > > > > > > > Rick, > > > > > > > > interesting! Would you mind to post some info/snippets about it? > > > > I guess you mean something like reimplementing Dialog - > > > > including your own ui-event pump and so on. > > > > I always thought this still wasn't possible without a true modal > > > > (native/peer) window component. > > > > > > > > Torsten > > > > > > > > "Rick Ingham" <rdingham@home.com> wrote: > > > > >I did this once using thread synchronization and an overridden > show()/hide() that called wait()/notify(). > > > > > > > > > > >
Technical Details
Message-ID:
<94av0c$6i95@bornews.inprise.com>Path:
arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!sn-xit-01!supernews.com!feeder.qis.net!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!fu-berlin.de!news.bnb-lp.com!bornews.borland.com!not-for-mailReferences:
<3a6369f0_1@dnews> <3a6564c7$1_2@dnews> <944b6j$pcp18@bornews.inprise.com> <3a669326$1_2@dnews> <948gf1$nu85@bornews.inprise.com> <948o7v$nnm5@bornews.inprise.com> <3a68bcad_2@dnews>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,4562037466fa7b2c X-Google-Attributes: gid111d45,public X-Google-ArrivalTime: 2001-01-19 19:10:40 PST From: "Rick Ingham" <rdingham@home.com> Newsgroups: borland.public.jbuilder.java.swing Subject: Re: I need a window which is modal Date: Fri, 19 Jan 2001 19:01:24 -0800 Organization: Another Netscape Collabra Server User Lines: 66 Message-ID: <94av0c$6i95@bornews.inprise.com> References: <3a6369f0_1@dnews> <3a6564c7$1_2@dnews> <944b6j$pcp18@bornews.inprise.com> <3a669326$1_2@dnews> <948gf1$nu85@bornews.inprise.com> <948o7v$nnm5@bornews.inprise.com> <3a68bcad_2@dnews> NNTP-Posting-Host: c191422-a.sttln1.wa.home.com Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!sn-xit-01!supernews.com!feeder.qis.net!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!fu-berlin.de!news.bnb-lp.com!bornews.borland.com!not-for-mail