🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: How to refocus an open (modal==false) jDialog

#425
From: Magnus
Date: Thu, 12 May 2005 15:45
58 lines
3123 bytes
Follow up on this issue:

I have a main-window that has a button to show all details for a 
selected item in a list.

The window is defined as: public class ViewDetails extends JDialog {

The constructor opens this as modal=true;

While testing I had the ViewDetails opened over the main-window when I 
selected to clear the desktop (i.e. no windows open). I then clicked in 
the bottom toolbar to swap back to application and here is where the 
problem occurred:

The process came back but the main-window was in front of the ViewDetail 
window (that is smaller than the main-window). Since it was running in 
modal, I could not move the main-window or get to the ViewDetail in any 
way.

The way I got around this was to open another window (my browser) and 
then the VIewDetail was put in front of the main-window. I minimized the 
browser and could continue with my app.

Now, I can't write in the manual "if you can't see your window - open 
another application and the window will appear ..."

Anyone has a solution for this behavior?


Magnus wrote:

> I have changed the from "extend JDialog" to "extend JFrame" but still 
> have the same question ...
> 
> Magnus wrote:
> 
>> Hello,
>>
>> I have a menu entry that open a dialog.
>> The user can go back to original screen and open a new dialog from the 
>> same menu entry.
>> I would like to re-focus on the first one but can find a way to do this.
>>
>>   public void jMenuItem1_actionPerformed(ActionEvent e) {
>>
>> // Here I want to refocus if opened before ...
>>
>>     Calculator dlg = new Calculator(this, "Just Test of Dialog", false);
>>     Dimension dlgSize = dlg.getPreferredSize();
>>     Dimension frmSize = getSize();
>>     Point loc = getLocation();
>>     dlg.setLocation((frmSize.width - dlgSize.width) / 2 + loc.x,
>>                        (frmSize.height - dlgSize.height) / 2 + loc.y);
>>     dlg.pack();
>>     dlg.show();
>>   }
>>
>> Thanks in advance
Technical Details
Message-ID: <42837a0d@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!solnet.ch!solnet.ch!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!news-in.nuthinbutnews.com!news-in.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <42669161@newsgroups.borland.com> <42691bc7$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 111d45,96415b146a3c2aed
X-Google-Attributes: gid111d45,public
X-Google-Language: ENGLISH,ASCII-7-bit
Date: Thu, 12 May 2005 11:45:35 -0400
From: Magnus <magnus_bjorkman@iwon.com>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.2) Gecko/20040804 Netscape/7.2 (ax)
X-Accept-Language: en-us, en, sv
MIME-Version: 1.0
Newsgroups: borland.public.jbuilder.java.swing
Subject: Re: How to refocus an open (modal==false) jDialog
References: <42669161@newsgroups.borland.com> <42691bc7$1@newsgroups.borland.com>
In-Reply-To: <42691bc7$1@newsgroups.borland.com>
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 67.76.179.221
Message-ID: <42837a0d@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1115912717 67.76.179.221 (12 May 2005 08:45:17 -0700)
Lines: 58
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!solnet.ch!solnet.ch!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!news-in.nuthinbutnews.com!news-in.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail