本文整理汇总了Java中javafx.scene.layout.GridPane.setMaxHeight方法的典型用法代码示例。如果您正苦于以下问题:Java GridPane.setMaxHeight方法的具体用法?Java GridPane.setMaxHeight怎么用?Java GridPane.setMaxHeight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.layout.GridPane
的用法示例。
在下文中一共展示了GridPane.setMaxHeight方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: makeGrid
import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
private void makeGrid() {
myGrid = new GridPane();
myGrid.setMaxHeight(getScreenHeight());
myGrid.setMaxWidth(getScreenWidth());
for (int i = 0; i < getNumRows(); i++) {
RowConstraints row = new RowConstraints(getScreenHeight()/getNumRows());
myGrid.getRowConstraints().add(row);
}
for (int j = 0; j < getNumCols(); j++) {
ColumnConstraints col = new ColumnConstraints(getScreenWidth()/getNumCols());
myGrid.getColumnConstraints().add(col);
}
for (int i = 0; i < getNumRows(); i++) {
for (int j = 0; j < getNumCols(); j++) {
myGrid.add(new Rectangle(CELL_SIZE, CELL_SIZE, Color.WHITESMOKE), j, i);
}
}
this.getChildren().clear();
this.getChildren().add(myGrid);
}
示例2: createSideBar
import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
private Node createSideBar(ObservableList<SamplePage> relatedSamples) {
GridPane sidebar = new GridPane() {
// stretch to allways fill height of scrollpane
@Override protected double computePrefHeight(double width) {
return Math.max(
super.computePrefHeight(width),
getParent().getBoundsInLocal().getHeight()
);
}
};
sidebar.getStyleClass().add("right-sidebar");
sidebar.setMaxWidth(Double.MAX_VALUE);
sidebar.setMaxHeight(Double.MAX_VALUE);
int sideRow = 0;
// create side bar content
// description
Label discTitle = new Label("Related Samples");
discTitle.getStyleClass().add("right-sidebar-title");
GridPane.setConstraints(discTitle, 0, sideRow++);
sidebar.getChildren().add(discTitle);
// add sample tiles
for (SamplePage sp: relatedSamples) {
Node tile = sp.createTile();
GridPane.setConstraints(tile, 0, sideRow++);
sidebar.getChildren().add(tile);
}
return sidebar;
}