本文整理汇总了Java中javafx.stage.Stage.setOpacity方法的典型用法代码示例。如果您正苦于以下问题:Java Stage.setOpacity方法的具体用法?Java Stage.setOpacity怎么用?Java Stage.setOpacity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.stage.Stage
的用法示例。
在下文中一共展示了Stage.setOpacity方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: openHelpText
import javafx.stage.Stage; //导入方法依赖的package包/类
/**
* @param url the url of the website to be shown
*/
public static void openHelpText(String title, String url) {
WebView wv = new WebView();
wv.getEngine().setJavaScriptEnabled(false);
wv.getEngine().load(url);
Scene pane = new Scene(wv);
Stage state = new Stage();
state.setScene(pane);
// pane.getButtonTypes().add(ButtonType.CLOSE);
state.setAlwaysOnTop(true);
state.setTitle(title);
state.setResizable(true);
state.setOpacity(0.8);
state.setMinHeight(250);
state.setMinWidth(250);
state.show();
}
示例2: start
import javafx.stage.Stage; //导入方法依赖的package包/类
@Override
public void start(Stage stage) {
Injector injector = Guice.createInjector(new GlobalModule());
FilePersistence filePersistence = injector.getInstance(FilePersistence.class);
EventBus eventBus = injector.getInstance(EventBus.class);
injector.getInstance(FileChooserComponent.class).setOwner(stage);
Scene scene = new Scene(injector.getInstance(AnimationEditorComponent.class).getRoot(), INITIAL_WIDTH, INITIAL_HEIGHT);
scene.getStylesheets().add(getClass().getResource(STYLESHEET).toExternalForm());
stage.setScene(scene);
if (OsHelper.isWindows()) {
stage.getIcons().add(new Image(getClass().getResource(ICON).toExternalForm()));
}
stage.titleProperty().bind(filePersistence.getTitle());
stage.setOnCloseRequest(event -> {
eventBus.post(MenuActionEvent.EXIT);
event.consume();
});
injector.getInstance(StageConfigurer.class).initialize(stage);
stage.setOpacity(0);
stage.show();
eventBus.post(LifecycleEvent.STAGE_ABOUT_TO_SHOW);
Platform.runLater(() -> {
stage.setOpacity(1);
if (filePersistence.loadLastEditedFileIfExists()) {
injector.getInstance(PanningHelper.class).panToContent();
}
});
}