4

I have a main Stage and would like to create multiple additional Stages (Windows). These would be like palettes in Photoshop that control the main Stage, but I want the functionality of having a title bar, resizing, and being able to drag these anywhere on multiple monitors (the Popup class doesn't have this).

However I don't want these stealing the focus from the main window all the time, in fact they should never steal the focus, it would be best to have them all in the foreground simultaneously. Is there anyway to do this? I tried requestFocus() on the main Stage but it doesn't even seem to work. The only thing I can think of now is to implement a custom control to display a title bar and create a Popup but it sounds like a pain, Thanks

JavaMonkey22
  • 861
  • 11
  • 20

1 Answers1

0

Yes, it should work with .requestFocus().
But for some reason you have to do it twice:

primaryStage.requestFocus();  //put focus from dialog to main window

Platform.runLater(new Runnable() {
  @Override
  public void run() {

    //focus again??? only then it works :-(
    primaryStage.requestFocus();  //put focus from dialog to main window
  }
});
Bernhard Barker
  • 54,589
  • 14
  • 104
  • 138
Ingo
  • 605
  • 6
  • 10
  • Maby there is a way to never set focus on new window? I have a notification window, it steal the focus all the time, from any programm, when shows, its a bit annoying... – Igor Bloom Sep 21 '15 at 11:24