本文整理汇总了Java中javafx.scene.layout.FlowPane.setPrefWrapLength方法的典型用法代码示例。如果您正苦于以下问题:Java FlowPane.setPrefWrapLength方法的具体用法?Java FlowPane.setPrefWrapLength怎么用?Java FlowPane.setPrefWrapLength使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.layout.FlowPane
的用法示例。
在下文中一共展示了FlowPane.setPrefWrapLength方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: FlowPaneSample
import javafx.scene.layout.FlowPane; //导入方法依赖的package包/类
public FlowPaneSample() {
super(400, 400);
FlowPane flowPane = new FlowPane(2, 4);
flowPane.setPrefWrapLength(200); //preferred wraplength
Label[] shortLabels = new Label[ITEMS];
Label[] longLabels = new Label[ITEMS];
ImageView[] imageViews = new ImageView[ITEMS];
for (int i = 0; i < ITEMS; i++) {
shortLabels[i] = new Label("Short label.");
longLabels[i] = new Label("I am a slightly longer label.");
imageViews[i] = new ImageView(ICON_48);
flowPane.getChildren().addAll(shortLabels[i], longLabels[i], imageViews[i]);
}
getChildren().add(flowPane);
}
示例2: createStad
import javafx.scene.layout.FlowPane; //导入方法依赖的package包/类
/**
* FlowPane met GebouwKaartViews
*/
private void createStad() {
stadPane = new FlowPane();
stadPane.setPadding(new Insets(125, 0, 5, 50));
stadPane.setVgap(-40);
stadPane.setHgap(-15);
stadPane.setPrefWrapLength(360);
// Loop door gebouwKaartViews en voeg ze toe aan het FlowPane
for (GebouwKaartView gebouwKaartView: gebouwKaartViews) {
stadPane.getChildren().add(gebouwKaartView.view()); // Voeg view to aan Pane
}
}
示例3: createDetailsPane
import javafx.scene.layout.FlowPane; //导入方法依赖的package包/类
private FlowPane createDetailsPane() {
FlowPane detailsPane = new FlowPane();
detailsPane.setMaxWidth(CARD_WIDTH);
detailsPane.setPrefWrapLength(CARD_WIDTH);
detailsPane.setHgap(3);
detailsPane.setVgap(3);
return detailsPane;
}
示例4: UnitButtonGrouped
import javafx.scene.layout.FlowPane; //导入方法依赖的package包/类
/**
* Constructor for the grouped button.
*/
public UnitButtonGrouped() {
locationId = new String();
expanded = false;
groupingPane = new FlowPane();
groupingPane.setPrefWrapLength(2 * (Constants.SMALL_ICON + (2 * Constants.INSETS)));
iconPane = new GridPane();
stackPane = new StackPane();
unitCount = new Text("0");
unitCount.setTextAlignment(TextAlignment.LEFT);
unitCount.setStyle("-fx-font: 10pt Tahoma; -fx-fill: black; -fx-stroke: white; -fx-stroke-width: 0.2px;");
unitCount.textProperty().bind(Bindings.size(groupingPane.getChildren()).asString());
iconPane.getChildren().add(unitCount);
stackPane.getChildren().add(iconPane);
stackPane.getChildren().add(groupingPane);
this.getChildren().add(stackPane);
clipRectangle1 = new Rectangle(Constants.SMALL_ICON, Constants.SMALL_ICON);
this.setClip(clipRectangle1);
groupingPane.layoutBoundsProperty().addListener((ov, oldValue, newValue) -> {
clipRectangle1.setWidth(newValue.getWidth());
clipRectangle1.setHeight(newValue.getHeight());
});
final EventHandler<MouseEvent> mouseEventHandler = (event) -> {
event.consume();
if (!expanded) {
expand();
expanded = true;
}
};
final EventHandler<MouseEvent> mouseExitedHandler = (event) -> {
event.consume();
if (expanded) {
shrink();
expanded = false;
}
};
stackPane.setOnMouseClicked(mouseEventHandler);
stackPane.setOnMouseExited(mouseExitedHandler);
this.getStyleClass().clear();
this.getStyleClass().addAll("units-button");
}