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