A javaFX Stage could be both StageStyle.UTILITY and StageStyle.TRANSPARENT?
Asked Answered
A

5

7

I mean that when using a stage with stageStyle.UTILITY, I don't want to show the "solid white background " but a transparent background.

I need a stage doesn't shown on the windows' task bar below(stageStyle.UTILITY can satisfy), and I need a transparent background(StageStyle.TRANSPARENT can satisfy)so that I can define the close button style of my stage.

But it seems strange that stageStyle.UTILITY or StageStyle.TRANSPARENT only fit one of my request.

Thank you.

Aeolus answered 19/3, 2013 at 14:38 Comment(2)
Possible duplicate of Is it possible to have a transparent utility stage in javafx?Durman
https://mcmap.net/q/831517/-how-can-i-remove-my-javafx-program-from-the-taskbar this answer has a very nice way to do it!Pomposity
A
4

Already OK! Also invoke dialogStage.initOwner(parentStage) http://docs.oracle.com/javafx/2/api/javafx/stage/Stage.html#initOwner%28javafx.stage.Window%29

Aeolus answered 20/3, 2013 at 9:13 Comment(1)
I see when the parentStage is minimized or maximized, the childStage will be minimized and maximized too. Could you please share the way to fix this problem? Thank you!Galilee
E
1

something thus?

enter image description here

has an effect on the background

leads code

dialog.initModality(Modality.WINDOW_MODAL);
Evaporation answered 20/3, 2013 at 10:45 Comment(0)
I
1

It is not yet possible in javafx but javafx is swing compatible so you can use swing to make a swing equivalent to a transparent utility stage. See here for some examples. I hope that this helps.

Increscent answered 4/1, 2015 at 16:21 Comment(0)
E
0
final Stage stage = new Stage(StageStyle.TRANSPARENT);
Group rootGroup = new Group();
Scene scene = new Scene(rootGroup, 339, 319, Color.TRANSPARENT);
stage.setScene(scene);
stage.centerOnScreen();
stage.show();
Evaporation answered 19/3, 2013 at 16:18 Comment(2)
Thank you, Jackson, But you may mistake. StageStyle.TRANSPARENT can't make my popup stage not shown on the windows' task bar below, Only stageStyle.UTILITY can satisfy. So i need a popup stage with both stageStyle.UTILITY and transparent background(no default close button).Aeolus
Already OK. Also invoke dialogStage.initOwner(parentStage) docs.oracle.com/javafx/2/api/javafx/stage/…Aeolus
D
0

Look here How can I remove my javafx program from the taskbar

just add (to move it out of sight)

primaryStage.setX(Double.MAX_VALUE);
primaryStage.setY(Double.MAX_VALUE);

and replace

mainStage.initStyle(StageStyle.UNDECORATED);

with

mainStage.initStyle(StageStyle.TRANSPARENT);
Derosier answered 23/8, 2018 at 15:38 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.