JavaFX Secondary Screen "Always on Top" of All Applications -


i've read using jdialog wrap jfxpanel in order use jdialog's alwaysontop method. works, i'm having small issue hack.

since i'm using technique make secondary windows main application (popups etc), need set them on top of main window. if use wrapper hack this, top panel "always on top" of everything (including other applications).

is there way put secondary screen only on top of application? don't fact application can dragged in between main window , secondary window of application.

i suggest not using jdialog , jfxpanel, using javafx stages.

make secondary screen stage , invoke secondarystage.initowner(primarystage) before show secondary stage.

from stage documentation:

a stage can optionally have owner window. when window stage's owner, said parent of stage . . . stage on top of parent window.

i believe setting owner of secondary stage, correctly fulfills requirement of "secondary screen on top of application".


update: answers additional questions comments

i don't want there interaction main stage once secondary open (the secondary window must closed allow interaction again).

to block input primary stage, before showing secondary stage, call: secondarystage.initmodality(modality.window_modal).

you use application_modal instead of window_modal if preferred block input other of application windows - 1 use depends on user experience want.

there's nothing obvious in api center secondary screen on main screen. centers on monitor, no matter main screen is.

this part of question duplicate of center location of stage. answer duplicate has sample code performing centering of child window.

that's right, there nothing in public api around positioning child windows relative parent windows. i've filed feature request functionality add helper methods positioning popups relative nodes, feature request has not yet been implemented of javafx 2.2.

there sample project created relative positioning of child dialogs, might useful.

just centering within parent, best off querying stage location , width before displaying child , setting x , y co-ordinates of child appropriately when display it. of can done based on x, y , width properties of windows.

there dialog project in javafx ui controls sandbox might provides of functionality require don't need code yourself.

in time of functionality requesting end in javafx core platform, don't think it's quite there yet javafx 2.2.


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -