Javafx popup will not hide behind another application when focus is lost

So, my question, as indicated (sort of) in the title, concerns the behavior in some aspects of the Javafx popup (namely 2.2). In most cases, you get a popup, and you give it a window to act like it's a parent, you give it some kind of scene, and it tends to act relatively independently.

All this is fine, but in my case I needed a pop-up window that would snap to a certain stage (window) in a specific place when the event occurred. This popup will then, in turn, disappear when the window disappears (minimize, turn off the screen, etc.), Move when it is, and in essence and functionality will become a physical extension of the window, only with a user-defined form.

Now, of course, there are many nuances with this, and for the most part, everything works fine. Perhaps the only thing I can’t understand is what is usually on a platform, for example, Windows 7 64 bit. You open two programs, good. Then, if the programs overlap a bit, depending on what focus the entire displayed program falls on, while the other gives the impression that it is “behind” the other window. (Regardless of whether the windows really display the application graphics “behind” the window when the other focuses on the same place, I'm not sure.). Generally, javafx also supports this feature just fine. But for some reason, the Popup class in javafx (see Docs here) does not do this. It is always on top of everything that is displayed, without exception. As for completeness, here is my pretty simple popup code (at least the part related to showing it and its properties):

        Popup myPop = new Popup();
        //************************Popup Property Setter**************************
        //&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
        myPop.setWidth(width);
        myPop.setHeight(initialHeight);
        myPop.setAutoHide(false);
        myPop.setAutoFix(false);
        myPop.setHideOnEscape(false);
        myPop.setX(xLocation);
        myPop.setY(yLocation);
        //&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
        //**********************end of Popup Properties**************************
        myPop.getContent().add(main_anchor);
        myPop.show(FileChooserWindow.get_stage());

The main anchor has several different components that include the "myPop" popup window, and FileChooserWindow is not an empty parent window that will open when this method is called without exception.

Here is a screenshot and the behavior I'm talking about. Pay attention to the selected pdf text in which my cursor currently has focus. In addition, the window on which the pop-up window is attached can be seen at the end of the pdf file that has broken out on the left.Image Of the stubborn popup

, , , , . , , PITA.

+3
1

, , , .

, , changeListener , ( , , , -, ).

:

FileChooserWindow.get_stage().focusedProperty().addListener(new ChangeListener<Boolean>(){
            @Override
            public void changed(ObservableValue<? extends Boolean> ov, Boolean oldValue, Boolean newValue) {
                if (!newValue){
                    if(AutogenPopup.popupReturner().focusedProperty().get()){
                        AutogenPopup.popupReturner().hide();
                    }
                }else{
                    if(FileChooserController.refreshAutoPopup && FileChooserController.autoGen_flag){
                        AutogenPopup.popupReturner().show(FileChooserWindow.get_stage());
                    }
                }
            }

        });

, , , , , .

. AutogenPopup.popupReturner().focusedProperty().get() , true, LOST . , , , . , , , ​​ . , , , , . (, , , ).

, , -, , .

+1

All Articles