0

My project is a MainGUI and two other GUIs (separate "application sample forms", JFrames) that open when certain buttons are pressed in the MainGUI. One of the other guis, called the OpenCSVGUI is supposed to come up at the beginning of the project and stay there until the tasks in the OpenCSVGUI are completed (which is reading in a .csv file and, once that's done, setting the "informationGathered" boolean in the MainGUI to true.) How do I make the program switch back to the OpenCSVGUI window everytime the user tries to do something on the MainGUI until this is done?

I have been coding in Java for a year now so if you see an answer that seems obvious to you, please mention it because it probably won't be to me!

Thank you

Federico Pettinella
  • 1,471
  • 1
  • 11
  • 19
  • you need to use a JDialog. check this link: http://stackoverflow.com/questions/14795995/how-can-i-set-a-jframe-to-be-always-on-top-and-focuse-enabled-until-it-is-closed –  Jun 05 '13 at 09:40

1 Answers1

1

use frame.setAlwaysOnTop(true)

AlexR
  • 114,158
  • 16
  • 130
  • 208
  • this will keep it on top but will it keep it in focus (in the question he wants the user to switch back to the frame on top if the user clicks on the one below) ? –  Jun 04 '13 at 19:44
  • Yes I've tried this but it doesn't work. The frame stays on top once but then is in the background once I click the other frame. If this were to keep frame1 over frame2 *permanently* until I (in the code) call setAlwaysOnTop(false), then it would be what I'm looking for. – Federico Pettinella Jun 05 '13 at 09:03