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

4

1 回答 1

0

是的,它应该与.requestFocus().
但是由于某种原因,您必须执行两次:

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
  }
});
于 2014-05-25T07:36:43.167 回答