Thread View: borland.public.jbuilder.java.swing
6 messages
6 total messages
Started by Magnus
Wed, 20 Apr 2005 17:29
How to refocus an open (modoal==false) jDialog
Author: Magnus
Date: Wed, 20 Apr 2005 17:29
Date: Wed, 20 Apr 2005 17:29
22 lines
1722 bytes
1722 bytes
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
Re: How to refocus an open (modal==false) jDialog
Author: Magnus
Date: Fri, 22 Apr 2005 15:44
Date: Fri, 22 Apr 2005 15:44
26 lines
1839 bytes
1839 bytes
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
Re: How to refocus an open (modal==false) jDialog
Author: Magnus
Date: Thu, 12 May 2005 15:45
Date: Thu, 12 May 2005 15:45
58 lines
3123 bytes
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
Re: How to refocus an open (modal==false) jDialog
Author: Lori M Olson [TeamB]
Date: Thu, 12 May 2005 15:54
Date: Thu, 12 May 2005 15:54
60 lines
3227 bytes
3227 bytes
Magnus wrote:
> 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?
>
Submarining modal windows are a problem with many Windows applications.
This is not necessarily a Java-specific issue. I find a lot of
install programs do something similar.
I generally use "Alt-Tab" to find these sorts of "hidden" windows, not
opening another application...
You need to investigate/google focus issues and z-order issues with
modal windows/dialogs. These things tend to be very application
specific, so a solution that worked for someone else may not work for
your application.
--
Regards,
Lori Olson [TeamB]
------------
Save yourself, and everyone else, some time and search the
newsgroups and the FAQ-O-Matic before posting your next
question.
Google Advanced Newsgroup Search
http://www.google.ca/advanced_group_search
Other Newsgroup Searches:
http://www.borland.com/newsgroups/ngsearch.html
Joi Ellis's FAQ-O-Matic:
http://www.visi.com/~gyles19/fom-serve/cache/1.html
Re: How to refocus an open (modal==false) jDialog
Author: Magnus
Date: Thu, 12 May 2005 16:05
Date: Thu, 12 May 2005 16:05
57 lines
3181 bytes
3181 bytes
Thanks Lori,
The Alt-tab works fine and is something (in my mind) that can be put
into the manual as a "global" solution.
For the re-focus issue I will start with a flag that is set true/false
from the dialog (or any type of window) and tested on before open a new
window.
I will attack this later in more detail.
Lori M Olson [TeamB] wrote:
> Magnus wrote:
>
>> 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?
>>
>
> Submarining modal windows are a problem with many Windows applications.
> This is not necessarily a Java-specific issue. I find a lot of install
> programs do something similar.
>
> I generally use "Alt-Tab" to find these sorts of "hidden" windows, not
> opening another application...
>
> You need to investigate/google focus issues and z-order issues with
> modal windows/dialogs. These things tend to be very application
> specific, so a solution that worked for someone else may not work for
> your application.
>
Re: How to refocus an open (modoal==false) jDialog
Author: Magnus
Date: Tue, 14 Jun 2005 19:41
Date: Tue, 14 Jun 2005 19:41
50 lines
2642 bytes
2642 bytes
Returning to my old problem.
For now I have solved this with a flag that is set when the window is
opened and reset upon close. I then test on its flag before open a "new"
window every time.
To be able to reset the flag I added :
setupWindow.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent we) {
setMyFlag(false);
}
});
This works great if the "x" in the frame is used to close the window,
but, I have added a "close" button in my setupWindow and the actioncode
there is: this.dispose();
Now that doesn't bring me to my listener above so I must make my flag
static and I call setMyFlag from the close-button.
Can I use something else than "this.dispose()" to get the same action as
for the "x" in upper frame menu?
Thanks for any help and hints.
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
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads