【发布时间】:2017-11-09 08:38:03
【问题描述】:
我创建了一个自定义对话框,其中包含我自己的窗格和控件。但是对话框有一个白色边框默认值,我想删除它。这是一个带有单个图像的示例:
我尝试使用 ScenicView 但找不到捕获对话框层并对其进行修改的方法:
public class MainView extends View {
Image img = new Image("https://i.stack.imgur.com/7bI1Y.jpg", 300, 500, true, true);
public MainView(String name) {
super(name);
Button b = new Button("Pop");
b.setOnAction(e -> {
Dialog<Void> dialog = new Dialog<>();
dialog.setOnShown(e2 -> {
Parent parent = getParent();
Pane p = (Pane) parent.lookup(".dialog");
p.setPadding(new Insets(0));
});
dialog.setGraphic(new ImageView(img));
dialog.showAndWait();
});
setCenter(b);
}
}
我得到的最好的方法是移除流窗格子以移除一些下部
dialog.setOnShown(e2 -> {
Parent parent = getParent();
Pane p = (Pane) parent.lookup(".dialog");
p.getChildren().removeIf(c -> (c instanceof FlowPane));
System.out.println(p.getChildren());
});
删除 VBox 会移动我不想做的对话框并更改其填充也没有任何作用。
【问题讨论】:
标签: gluon-mobile