Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Focusing on a particular window

 
Alex Iordache
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic