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

♀尐吖头ヾ 提交于 2019-11-27 06:59:29

问题


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.


回答1:


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




回答2:


something thus?

has an effect on the background

leads code

dialog.initModality(Modality.WINDOW_MODAL);



回答3:


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.




回答4:


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();



回答5:


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);


来源:https://stackoverflow.com/questions/15502451/a-javafx-stage-could-be-both-stagestyle-utility-and-stagestyle-transparent

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!