本文整理汇总了Java中javafx.scene.layout.AnchorPane.setPrefSize方法的典型用法代码示例。如果您正苦于以下问题:Java AnchorPane.setPrefSize方法的具体用法?Java AnchorPane.setPrefSize怎么用?Java AnchorPane.setPrefSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.layout.AnchorPane
的用法示例。
在下文中一共展示了AnchorPane.setPrefSize方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createIconContent
import javafx.scene.layout.AnchorPane; //导入方法依赖的package包/类
public static Node createIconContent() {
StackPane sp = new StackPane();
AnchorPane anchorPane = new AnchorPane();
Rectangle rectangle = new Rectangle(62, 62, Color.LIGHTGREY);
rectangle.setStroke(Color.BLACK);
anchorPane.setPrefSize(rectangle.getWidth(), rectangle.getHeight());
Rectangle r1 = new Rectangle(14, 14, Color.web("#1c89f4"));
Rectangle r2 = new Rectangle(45, 10, Color.web("#349b00"));
Rectangle r3 = new Rectangle(35, 14, Color.web("#349b00"));
anchorPane.getChildren().addAll(r1, r2, r3);
AnchorPane.setTopAnchor(r1, Double.valueOf(1));
AnchorPane.setLeftAnchor(r1, Double.valueOf(1));
AnchorPane.setTopAnchor(r2, Double.valueOf(20));
AnchorPane.setLeftAnchor(r2, Double.valueOf(1));
AnchorPane.setBottomAnchor(r3, Double.valueOf(1));
AnchorPane.setRightAnchor(r3, Double.valueOf(5));
sp.getChildren().addAll(rectangle, anchorPane);
return new Group(sp);
}
示例2: addTab
import javafx.scene.layout.AnchorPane; //导入方法依赖的package包/类
private void addTab(TreeMap treeMap) {
AnchorPane treeMapContainer = new AnchorPane();
treeMapContainer.setPrefSize(0, 0);
Tab tab = new Tab(treeMap.getData().getName(), treeMapContainer);
Node treeMapNode = treeMap.getNode();
treeMapContainer.getChildren().add(treeMapNode);
AnchorPane.setBottomAnchor(treeMapNode, 0.0);
AnchorPane.setLeftAnchor(treeMapNode, 0.0);
AnchorPane.setRightAnchor(treeMapNode, 0.0);
AnchorPane.setTopAnchor(treeMapNode, 0.0);
tabPane.getTabs().add(tab);
}
示例3: start
import javafx.scene.layout.AnchorPane; //导入方法依赖的package包/类
@Override public void start(Stage stage) {
AnchorPane pane = new AnchorPane(xAxisBottom, yAxisLeft);
pane.setPadding(new Insets(10));
pane.setPrefSize(400, 400);
Scene scene = new Scene(pane);
stage.setTitle("Title");
stage.setScene(scene);
stage.show();
}
示例4: start
import javafx.scene.layout.AnchorPane; //导入方法依赖的package包/类
@Override public void start(Stage stage) {
AnchorPane pane = new AnchorPane(xAxisBottom, xAxisTop, yAxisLeft, yAxisRight);
pane.setPadding(new Insets(10));
pane.setPrefSize(400, 400);
Scene scene = new Scene(pane);
stage.setTitle("Title");
stage.setScene(scene);
stage.show();
}