Meaningless Drivel is fun!
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

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

Joined: Feb 05, 2001
Posts: 17276

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

Perfect World Programming, LLC - iOS Apps
How to Ask Questions the Smart Way FAQ
I agree. Here's the link:
subject: Focusing on a particular window
It's not a secret anymore!