aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Focusing on a particular window Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Focusing on a particular window" Watch "Focusing on a particular window" New topic
Author

Focusing on a particular window

Alex Iordache
Ranch Hand

Joined: Mar 13, 2001
Posts: 62
I have a java Swing application that works like this:
a JFrame main window calls a non-modal JDialog box, once set visible, the focus naturally goes to the JDialog. This dialog displays a list of records. Upon the selection of one of the records, I want to set the focus back on the main window. To be specific, I want the main window to become the active window in which the user can do work. Sort of like bringing the main window to the front.
How can I do that?
FYI, I'm using JDK1.2.2 on WinNT platform
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

Two things I can think of, off the top of my head.
First a window has a show and a hide method. If you have a main class that instantiates the two classes, you can have the main class control which window is hidden and which is shown. I do think the JDialog is modal, which means the other window cannot do anything until the JDialog is gone and closed.
Hope that set you on a good path, and not one leading to the dark side
Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Focusing on a particular window
 
Similar Threads
JDialog Focus
JDialog problem
JDialog --PLS HELP !!
Multiple windows question
Window switching focus