有没有办法创建一个与父级具有相同属性的子窗口? [英] Is There any Way to Create A Child Window That Has the Same Properties as the Parent?

查看:172
本文介绍了有没有办法创建一个与父级具有相同属性的子窗口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道在摇摆中你可以用父母打开一个子窗口/对话框/框架,并且子窗口将具有与父窗口相同的属性,例如在左上角共享徽标。在JavaFX 8中是否有类似的功能?这会创建一个新窗口,但没有任何共享信息的父级(甚至可以关闭父级和子级不关闭):

I know that in swing you could open a child window/dialog/frame with a parent, and that the children windows would have kind of the same properties as the parent, such as sharing the emblem in the top left. Is there any kind of feature like that in JavaFX 8? This creates a new window, but doesn't have any parent that shares information(is even able to close parent and child doesn't close):

@FXML
private void onNewClanCreation(ActionEvent event) throws IOException {
    Parent root = FXMLLoader.load(getClass().getResource("ClanCreationPanel.fxml"));
    Stage stage = new Stage();
    stage.setScene(new Scene(root));
    stage.setResizable(false);
    stage.setTitle("New Clan Creation");
    stage.show();
    }

注意:我读过两个JavaFX 2.0 FXML儿童Windows JavaFX打开新窗口

NOTE: I've read both JavaFX 2.0 FXML Child Windows and JavaFX open new window.

推荐答案

在您展示舞台之前,初始化它的所有者:

Before you show your Stage initialize it's owner:

这篇关于有没有办法创建一个与父级具有相同属性的子窗口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆