本文整理匯總了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();
}