本文整理汇总了Java中javafx.scene.layout.FlowPane.setMargin方法的典型用法代码示例。如果您正苦于以下问题:Java FlowPane.setMargin方法的具体用法?Java FlowPane.setMargin怎么用?Java FlowPane.setMargin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.layout.FlowPane
的用法示例。
在下文中一共展示了FlowPane.setMargin方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addRoom
import javafx.scene.layout.FlowPane; //导入方法依赖的package包/类
private void addRoom(int roomId, Room room) {
final RoomView roomView = new RoomView(roomId, room);
roomView.setOnMouseClicked(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent t) {
if (selectRoom != null) {
selectRoom.setStyle("-fx-border-color: white;");
}
roomView.setStyle("-fx-border-color: red;");
selectRoom = roomView;
}
});
FlowPane.setMargin(roomView, new Insets(20, 0, 0, 40));
roomList.getChildren().add(roomView);
}
示例2: createIconContent
import javafx.scene.layout.FlowPane; //导入方法依赖的package包/类
public static Node createIconContent() {
StackPane sp = new StackPane();
FlowPane fp = new FlowPane();
fp.setAlignment(Pos.CENTER);
Rectangle rectangle = new Rectangle(62, 62, Color.LIGHTGREY);
rectangle.setStroke(Color.BLACK);
fp.setPrefSize(rectangle.getWidth(), rectangle.getHeight());
Rectangle[] littleRecs = new Rectangle[4];
Rectangle[] bigRecs = new Rectangle[4];
for (int i = 0; i < 4; i++) {
littleRecs[i] = new Rectangle(14, 14, Color.web("#1c89f4"));
bigRecs[i] = new Rectangle(16, 12, Color.web("#349b00"));
fp.getChildren().addAll(littleRecs[i], bigRecs[i]);
FlowPane.setMargin(littleRecs[i], new Insets(2, 2, 2, 2));
}
sp.getChildren().addAll(rectangle, fp);
return new Group(sp);
}
示例3: adjust
import javafx.scene.layout.FlowPane; //导入方法依赖的package包/类
/**
* Adjust the node with the specified scale.
* <p>
* If override this method, it should call the implementation of super-class.
* Because adjustment of the common settings are done by super-class.
*
* @param node the node class
* @param scale adjustment scale
* @return the node class that was adjust
*/
@Override
public Node adjust(Node node, double scale) {
requireNonNull(node);
requireValidScale(scale);
node.layoutXProperty().set(node.layoutXProperty().multiply(scale).get());
node.layoutYProperty().set(node.layoutYProperty().multiply(scale).get());
// If this node has the parent and it is a layout box,
// The size of anchors/margins must be set from children side
if (node.getParent() != null) {
Parent parent = (Parent) node.getParent();
// Set the size of anchors
if (parent instanceof AnchorPane) {
AnchorPane.setTopAnchor(node, multiplyNotNull(AnchorPane.getTopAnchor(node), scale));
AnchorPane.setRightAnchor(node, multiplyNotNull(AnchorPane.getRightAnchor(node), scale));
AnchorPane.setBottomAnchor(node, multiplyNotNull(AnchorPane.getBottomAnchor(node), scale));
AnchorPane.setLeftAnchor(node, multiplyNotNull(AnchorPane.getLeftAnchor(node), scale));
}
// Set the size of margins
if (parent instanceof BorderPane) {
BorderPane.setMargin(node, multiply(BorderPane.getMargin(node), scale));
}
if (parent instanceof FlowPane) {
FlowPane.setMargin(node, multiply(FlowPane.getMargin(node), scale));
}
if (parent instanceof GridPane) {
GridPane.setMargin(node, multiply(GridPane.getMargin(node), scale));
}
if (parent instanceof StackPane) {
StackPane.setMargin(node, multiply(StackPane.getMargin(node), scale));
}
if (parent instanceof TilePane) {
StackPane.setMargin(node, multiply(StackPane.getMargin(node), scale));
}
if (parent instanceof HBox) {
HBox.setMargin(node, multiply(HBox.getMargin(node), scale));
}
if (parent instanceof VBox) {
VBox.setMargin(node, multiply(VBox.getMargin(node), scale));
}
// TODO Add new settings when the new layout box that does not inherit above is implemented
}
return node;
}