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.

Keon Wang
  • 365
  • 1
  • 3
  • 15

5 Answers5

4

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

Keon Wang
  • 365
  • 1
  • 3
  • 15
  • 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! – GSP Apr 26 '16 at 02:50
1

something thus?

enter image description here

has an effect on the background

leads code

dialog.initModality(Modality.WINDOW_MODAL);
Perco
  • 160
  • 1
  • 18
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.

Community
  • 1
  • 1
sazzy4o
  • 3,073
  • 6
  • 34
  • 62
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();
Perco
  • 160
  • 1
  • 18
  • 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). – Keon Wang Mar 20 '13 at 07:34
  • Already OK. Also invoke dialogStage.initOwner(parentStage) http://docs.oracle.com/javafx/2/api/javafx/stage/Stage.html#initOwner%28javafx.stage.Window%29 – Keon Wang Mar 20 '13 at 09:10
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);
Mahe
  • 759
  • 1
  • 6
  • 21