本文整理汇总了Java中javafx.scene.layout.RowConstraints.setPercentHeight方法的典型用法代码示例。如果您正苦于以下问题:Java RowConstraints.setPercentHeight方法的具体用法?Java RowConstraints.setPercentHeight怎么用?Java RowConstraints.setPercentHeight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.layout.RowConstraints
的用法示例。
在下文中一共展示了RowConstraints.setPercentHeight方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: start
import javafx.scene.layout.RowConstraints; //导入方法依赖的package包/类
public void start(Stage primaryStage) {
canvas = new GridPane();
canvas.setPrefSize(800,800);
canvas.setGridLinesVisible(true);
final int numCols = 9 ;
final int numRows = 8 ;
for (int i = 0; i < numCols; i++) {
ColumnConstraints colConst = new ColumnConstraints();
colConst.setPercentWidth(100.0 / numCols);
canvas.getColumnConstraints().add(colConst);
}
for (int i = 0; i < numRows; i++) {
RowConstraints rowConst = new RowConstraints();
rowConst.setPercentHeight(100.0 / numRows);
canvas.getRowConstraints().add(rowConst);
}
scene = new Scene(canvas, 800, 800);
primaryStage.setScene(scene);
bubble = new Bubble(scene);
primaryStage.show();
scene.setFill(createGridPattern());
}
示例2: sector
import javafx.scene.layout.RowConstraints; //导入方法依赖的package包/类
/**
* Sets constraints of the columns and rows of the grid pane.
*/
private void sector () {
gameDisplayProperties = VoogaBundles.GameDisplayProperties;
ColumnConstraints leftColumn = new ColumnConstraints();
leftColumn.setPercentWidth(getConstraint("leftColConstraints"));
ColumnConstraints rightColumn = new ColumnConstraints();
rightColumn.setPercentWidth(getConstraint("rightColConstraints"));
RowConstraints topRow = new RowConstraints();
topRow.setPercentHeight(getConstraint("topRowConstraints"));
RowConstraints middleRow = new RowConstraints();
middleRow.setPercentHeight(getConstraint("middleRowConstraints"));
RowConstraints bottomRow = new RowConstraints();
bottomRow.setPercentHeight(getConstraint("bottomRowConstraints"));
this.getColumnConstraints().addAll(leftColumn, rightColumn);
this.getRowConstraints().addAll(topRow, middleRow, bottomRow);
}
示例3: applyRowConstraints
import javafx.scene.layout.RowConstraints; //导入方法依赖的package包/类
/**
* Method to apply the {@link RowConstraints} needed.
*/
private void applyRowConstraints() {
RowConstraints sinceFailureRow = new RowConstraints();
sinceFailureRow.setPercentHeight( SINCE_FAILURE_COMMITTERS_ROW_PERCENT );
sinceFailureRow.setMaxHeight( Double.MAX_VALUE );
RowConstraints newCommittersRow = new RowConstraints();
newCommittersRow.setPercentHeight( NEW_COMMITTERS_ROW_PERCENT );
newCommittersRow.setMaxHeight( Double.MAX_VALUE );
RowConstraints builtOnRow = new RowConstraints();
builtOnRow.setPercentHeight( BUILT_ON_ROW_PERCENT );
builtOnRow.setMaxHeight( Double.MAX_VALUE );
RowConstraints failuresRow = new RowConstraints();
failuresRow.setPercentHeight( FAILURES_ROW_PERCENT );
failuresRow.setMaxHeight( Double.MAX_VALUE );
getRowConstraints().addAll( sinceFailureRow, newCommittersRow, builtOnRow, failuresRow );
}
示例4: establishGridPane
import javafx.scene.layout.RowConstraints; //导入方法依赖的package包/类
/**
* Creates the 5 different panels that are used to hold different windows of
* the program
*/
private void establishGridPane() {
grid = new GridPane();
ColumnConstraints leftColumn = new ColumnConstraints();
leftColumn.setPercentWidth(COL70);
ColumnConstraints rightColumn = new ColumnConstraints();
rightColumn.setPercentWidth(COL30);
grid.getColumnConstraints().addAll(leftColumn, rightColumn);
for (int i = 0; i < 24; i++) {
RowConstraints row = new RowConstraints();
row.setPercentHeight(TWENTY_FOURTH);
grid.getRowConstraints().add(row);
}
List<Region> windows = Arrays.asList(variables, methods, history, console);
for (Region window : windows) {
windowsShowing.put(window.getClass().toString(), new Pair<Region, Boolean>(window, true));
}
setTopLeft(tabify(graphicsWindow, false));
setBottomLeft(tabify(displayedEditor, false));
setRightPanels(windowsShowing);
}
示例5: createColumnGridControls
import javafx.scene.layout.RowConstraints; //导入方法依赖的package包/类
/**
* Create a GridPane containing columns that resize similarly to Swing's GridLayout(),
* where controls have their widths bound to their parent.
*
* @param nodes
* @return
*/
public static GridPane createColumnGridControls(final Node... nodes) {
GridPane pane = new GridPane();
int n = nodes.length;
double maxMinWidth = 0;
for (int i = 0; i < n; i++) {
ColumnConstraints col = new ColumnConstraints();
col.setPercentWidth(100.0/n);
pane.getColumnConstraints().add(col);
Node node = nodes[i];
pane.add(node, i, 0);
if (node instanceof Control) {
maxMinWidth = Math.max(maxMinWidth, ((Control)node).getPrefWidth());
((Control)node).prefWidthProperty().bind(pane.widthProperty().divide(n));
}
}
RowConstraints row = new RowConstraints();
row.setPercentHeight(100);
pane.getRowConstraints().add(row);
pane.setMinWidth(maxMinWidth * n);
pane.setPrefWidth(maxMinWidth * n);
return pane;
}
示例6: createRowGridControls
import javafx.scene.layout.RowConstraints; //导入方法依赖的package包/类
/**
* Create a GridPane containing columns that resize similarly to Swing's GridLayout(),
* while also resizing contained objects to have the corresponding widths.
*
* @param nodes
* @return
*/
public static GridPane createRowGridControls(final Node... nodes) {
GridPane pane = new GridPane();
int n = nodes.length;
for (int i = 0; i < n; i++) {
RowConstraints row = new RowConstraints();
row.setPercentHeight(100.0/n);
pane.getRowConstraints().add(row);
Node node = nodes[i];
pane.add(node, 0, i);
if (node instanceof Control) {
// ((Control)node).setMinSize(((Control) node).getPrefWidth(), ((Control) node).getPrefHeight());
((Control)node).prefWidthProperty().bind(pane.widthProperty());
}
}
ColumnConstraints col = new ColumnConstraints();
col.setPercentWidth(100);
pane.getColumnConstraints().add(col);
return pane;
}
示例7: createColumnGridControls
import javafx.scene.layout.RowConstraints; //导入方法依赖的package包/类
/**
* Binds the width properties to the GridPane width.
*
* @param controls
* @return
*/
public static GridPane createColumnGridControls(final Control... controls) {
GridPane pane = new GridPane();
int n = controls.length;
for (int i = 0; i < n; i++) {
ColumnConstraints col = new ColumnConstraints();
col.setPercentWidth(100.0/n);
pane.getColumnConstraints().add(col);
Control control = controls[i];
pane.add(control, i, 0);
control.prefWidthProperty().bind(pane.widthProperty().divide(n));
}
RowConstraints row = new RowConstraints();
row.setPercentHeight(100);
pane.getRowConstraints().add(row);
return pane;
}
示例8: getEquiCellGrid
import javafx.scene.layout.RowConstraints; //导入方法依赖的package包/类
public Node getEquiCellGrid(){
GridPane grid = new GridPane();
grid.setGridLinesVisible(true); //debug
final int numRows = 10;
final int numColumns = 6;
for(int i = 0; i < numRows; i++) {
RowConstraints row = new RowConstraints();
row.setPercentHeight(100/numRows);
grid.getRowConstraints().add(row);
}
for(int i = 0; i < numRows; i++) {
ColumnConstraints column = new ColumnConstraints();
column.setPercentWidth(100/numColumns);
grid.getColumnConstraints().add(column);
}
// prevent grid from being resized larger so cells don't grow proportionally
grid.setMaxSize(Region.USE_PREF_SIZE, Region.USE_PREF_SIZE);
grid.addColumn(0, new Rectangle(75,75,Color.BLUE), new Rectangle(100,100,Color.RED));
grid.addRow(0, new Button("Blue"), new Button("Magenta"));
return grid;
}
示例9: createContent
import javafx.scene.layout.RowConstraints; //导入方法依赖的package包/类
@Override
protected Node createContent() {
leftSide = createLeftHandSide();
rightSide = createRightHandSide();
leftColumn = new ColumnConstraints();
leftColumn.setPercentWidth(50);
leftColumn.setMinWidth(Region.USE_COMPUTED_SIZE);
leftColumn.setPrefWidth(Region.USE_COMPUTED_SIZE);
leftColumn.setMaxWidth(Double.MAX_VALUE);
leftColumn.setFillWidth(true);
rightColumn = new ColumnConstraints();
rightColumn.setPercentWidth(50);
rightColumn.setMinWidth(Region.USE_COMPUTED_SIZE);
rightColumn.setPrefWidth(Region.USE_COMPUTED_SIZE);
rightColumn.setMaxWidth(Double.MAX_VALUE);
rightColumn.setFillWidth(true);
RowConstraints rowConstraints = new RowConstraints();
rowConstraints.setPercentHeight(100);
rowConstraints.setFillHeight(true);
// no need to assign a style class, will be auto-assigned by superclass ("content")
gridPane = new GridPane();
gridPane.setHgap(20);
gridPane.getColumnConstraints().addAll(leftColumn, rightColumn);
gridPane.getRowConstraints().addAll(rowConstraints);
gridPane.add(leftSide, 0, 0);
gridPane.add(rightSide, 1, 0);
getSkinnable().widthProperty().addListener(it -> updateLayout());
return gridPane;
}
示例10: start
import javafx.scene.layout.RowConstraints; //导入方法依赖的package包/类
@Override
public void start(Stage primaryStage) {
canvas = new GridPane();
canvas.setPrefSize(800,800);
canvas.setGridLinesVisible(true);
final int numCols = 9 ;
final int numRows = 8 ;
for (int i = 0; i < numCols; i++) {
ColumnConstraints colConst = new ColumnConstraints();
colConst.setPercentWidth(100.0 / numCols);
canvas.getColumnConstraints().add(colConst);
}
for (int i = 0; i < numRows; i++) {
RowConstraints rowConst = new RowConstraints();
rowConst.setPercentHeight(100.0 / numRows);
canvas.getRowConstraints().add(rowConst);
}
scene = new Scene(canvas, 800, 800);
primaryStage.setScene(scene);
bubble = new Bubble(scene);
primaryStage.show();
scene.setFill(createGridPattern());
}
示例11: start
import javafx.scene.layout.RowConstraints; //导入方法依赖的package包/类
@Override
public void start(Stage primaryStage) {
canvas = new GridPane();
canvas.setPrefSize(800,800);
canvas.setGridLinesVisible(true);
final int numCols = 9 ;
final int numRows = 8 ;
for (int i = 0; i < numCols; i++) {
ColumnConstraints colConst = new ColumnConstraints();
colConst.setPercentWidth(100.0 / numCols);
canvas.getColumnConstraints().add(colConst);
}
for (int i = 0; i < numRows; i++) {
RowConstraints rowConst = new RowConstraints();
rowConst.setPercentHeight(100.0 / numRows);
canvas.getRowConstraints().add(rowConst);
}
scene = new Scene(canvas, 800, 800);
primaryStage.setScene(scene);
bubble = new Bubble(scene);
primaryStage.show();
scene.setFill(createGridPattern());
}
示例12: start
import javafx.scene.layout.RowConstraints; //导入方法依赖的package包/类
public void start(Stage primaryStage) {
canvas = new GridPane();
canvas.setPrefSize(1300,741);
canvas.setGridLinesVisible(false);
final int numCols = 13 ;
final int numRows = 13 ;
for (int i = 0; i < numCols; i++) {
ColumnConstraints colConst = new ColumnConstraints();
colConst.setPercentWidth(100.0 / numCols);
canvas.getColumnConstraints().add(colConst);
}
for (int i = 0; i < numRows; i++) {
RowConstraints rowConst = new RowConstraints();
rowConst.setPercentHeight(100.0 / numRows);
canvas.getRowConstraints().add(rowConst);
}
scene = new Scene(canvas);
primaryStage.setScene(scene);
//primaryStage.sizeToScene();
//primaryStage.setFullScreen(true);
primaryStage.show();
scene.setFill(createGridPattern());
}
示例13: setObject
import javafx.scene.layout.RowConstraints; //导入方法依赖的package包/类
@Override
public void setObject(TreeDecomposition treedecomp, Consumer<Boolean> submitPossible) {
this.getChildren().clear();
if (treedecomp == null)
return;
TreeItem root = new TreeItem("root");
fillTreeView(root, treedecomp.rootBag);
TreeView treeView = new TreeView(root);
treeView.getSelectionModel().selectedItemProperty().addListener(
(ObservableValue observable, Object oldValue, Object newValue) -> {
TreeItem selectedItem = (TreeItem) newValue;
Bag bag = (Bag) selectedItem.getValue();
structurePane.clearSelection();
structurePane.selectAll(bag.nodes);
});
ColumnConstraints columnConstraints = new ColumnConstraints();
columnConstraints.setPercentWidth(100);
this.getColumnConstraints().add(columnConstraints);
RowConstraints rowConstraints = new RowConstraints();
rowConstraints.setPercentHeight(100);
this.getRowConstraints().add(rowConstraints);
this.add(treeView, 0, 0);
}
示例14: configureConstraintsForEvenRows
import javafx.scene.layout.RowConstraints; //导入方法依赖的package包/类
/**
* Method to configure an even number of columns, fairly sharing the width.
* @param pane the {@link GridPane} to configure.
* @param numberOfColumns the number of columns to divide the width in to.
*/
public void configureConstraintsForEvenRows( GridPane pane, int numberOfRows ){
double percentage = 100.0 / numberOfRows;
for ( int i = 0; i < numberOfRows; i++ ) {
RowConstraints column = new RowConstraints();
column.setPercentHeight( percentage );
pane.getRowConstraints().add( column );
}
}
示例15: configureConstraintsForRowPercentages
import javafx.scene.layout.RowConstraints; //导入方法依赖的package包/类
/**
* Method to configure the {@link RowConstraints} for the {@link GridPane} given.
* @param pane the {@link GridPane} to configure.
* @param percentages the percentages to add as constraints, {@link RowConstraints} per
* value provided.
*/
public void configureConstraintsForRowPercentages( GridPane pane, double... percentages ){
for ( double value : percentages ) {
RowConstraints row = new RowConstraints();
row.setPercentHeight( value );
pane.getRowConstraints().add( row );
}
}