Java 类javafx.scene.layout.RowConstraints 实例源码

项目:GazePlay    文件:Circles_handler2.java   
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());


    }
项目:CalendarFX    文件:MonthSheetViewSkin.java   
private void updateRowConstraints() {
    int rowCount = 32; // header + 31 days
    if (getSkinnable().getWeekDayLayout() == WeekDayLayoutStrategy.ALIGNED) {
        rowCount += 6; // 6 = max number of empty slots / cells at the top
    }

    List<RowConstraints> rowConstraints = new ArrayList<>();
    for (int i = 0; i <= rowCount; i++) {
        RowConstraints con = new RowConstraints();
        con.setFillHeight(true);
        con.setPrefHeight(Region.USE_COMPUTED_SIZE);
        con.setMinHeight(Region.USE_PREF_SIZE);
        con.setMaxHeight(Double.MAX_VALUE);
        con.setVgrow(i == 0 ? Priority.NEVER : Priority.ALWAYS);
        rowConstraints.add(con);
    }

    grid.getRowConstraints().setAll(rowConstraints);
}
项目:GazePlay    文件:HeatMap.java   
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());

    }
项目:voogasalad-ltub    文件:ScreenMap.java   
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);
}
项目:Game-Engine-Vooga    文件:UIGrid.java   
/**
 * 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);
}
项目:cd2t-100    文件:NodeController.java   
private void initGridPane() {
  List<NodeDescriptor> nodes = puzzle.getNodeDescriptors();

  int gridRows = nodes.stream()
                      .mapToInt(NodeDescriptor::getRow)
                      .max().getAsInt(),
      gridCols = nodes.stream()
                      .mapToInt(NodeDescriptor::getColumn)
                      .max().getAsInt();

  for (int i = 0; i < gridRows; ++i) {
    sourceCodeGridPane.getRowConstraints().add(new RowConstraints(300));
  }

  for (int i = 0; i < gridCols; ++i) {
    sourceCodeGridPane.getColumnConstraints().add(new ColumnConstraints(300));
  }
}
项目:JttDesktop    文件:FailureDetail.java   
/**
 * 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 );
}
项目:JttDesktop    文件:FailureDetailTest.java   
@Test public void shouldRestrainRowToFitInPanel(){
   assertThat( systemUnderTest.getRowConstraints(), hasSize( 4 ) );

   RowConstraints constraint = systemUnderTest.getRowConstraints().get( 0 );
   assertThat( constraint.getMaxHeight(), is( Double.MAX_VALUE ) );
   assertThat( constraint.getPercentHeight(), is( FailureDetail.SINCE_FAILURE_COMMITTERS_ROW_PERCENT ) );

   constraint = systemUnderTest.getRowConstraints().get( 1 );
   assertThat( constraint.getMaxHeight(), is( Double.MAX_VALUE ) );
   assertThat( constraint.getPercentHeight(), is( FailureDetail.NEW_COMMITTERS_ROW_PERCENT ) );

   constraint = systemUnderTest.getRowConstraints().get( 2 );
   assertThat( constraint.getMaxHeight(), is( Double.MAX_VALUE ) );
   assertThat( constraint.getPercentHeight(), is( FailureDetail.BUILT_ON_ROW_PERCENT ) );

   constraint = systemUnderTest.getRowConstraints().get( 3 );
   assertThat( constraint.getMaxHeight(), is( Double.MAX_VALUE ) );
   assertThat( constraint.getPercentHeight(), is( FailureDetail.FAILURES_ROW_PERCENT ) );
}
项目:slogo    文件:View.java   
/**
 * 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);

}
项目:qupath    文件:PanelToolsFX.java   
/**
 * 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;
}
项目:qupath    文件:PanelToolsFX.java   
/**
     * 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;
    }
项目:qupath    文件:PathAnnotationPanel.java   
/**
 * 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;
}
项目:bunkr    文件:AboutWindow.java   
@Override
public Parent initLayout()
{
    GridPane grid = new GridPane();
    grid.setHgap(10);
    grid.setHgap(10);
    grid.setPadding(new Insets(10));

    int row = 0;
    grid.add(this.projectRepoLabel, 0, row); grid.add(this.projectRepoValue, 1, row); row++;
    grid.add(this.versionLabel, 0, row); grid.add(this.versionValue, 1, row); row++;
    grid.add(this.compatVersionLabel, 0, row); grid.add(this.compatVersionValue, 1, row); row++;
    grid.add(this.gitCommitDateLabel, 0, row); grid.add(this.gitCommitDateValue, 1, row); row++;
    grid.add(this.gitCommitHashLabel, 0, row); grid.add(this.gitCommitHashValue, 1, row); row++;
    grid.add(this.buildDateLabel, 0, row); grid.add(this.buildDateValue, 1, row); row++;

    for (int i = 0; i < row; i++)
    {
        RowConstraints rc = new RowConstraints();
        rc.setPrefHeight(22);
        grid.getRowConstraints().add(rc);
    }

    return grid;
}
项目:manami    文件:CheckListController.java   
/**
 * @param entry
 */
private void addComponentListEntryToGridPane(final CheckListEntry entry) {
    Platform.runLater(() -> {
        gridPane.getRowConstraints().add(new RowConstraints());
        final int rowNumber = gridPane.getRowConstraints().size() - 1;

        gridPane.add(entry.getPictureComponent(), 0, rowNumber);
        gridPane.add(entry.getTitleComponent(), 1, rowNumber);
        gridPane.add(entry.getMessageComponent(), 2, rowNumber);
        gridPane.add(entry.getAdditionalButtons(), 3, rowNumber);

        final Button removeButton = new Button(EMPTY, createIconRemove());
        entry.setRemoveButton(removeButton);
        removeButton.setTooltip(new Tooltip("remove"));
        removeButton.setOnAction(event -> {
            removeEntry(entry);
        });

        gridPane.add(removeButton, 4, rowNumber);
        amountOfEntries++;
    });
}
项目:manami    文件:SearchResultsController.java   
/**
 * Adds all {@link AnimeGuiComponentsListEntry}s to the {@link GridPane}.
 *
 * @since 2.1.3
 */
private void showEntries(final GridPane gridPane, final List<AnimeGuiComponentsListEntry> guiComponentList) {
    guiComponentList.sort((a, b) -> Collator.getInstance().compare(a.getTitleComponent().getText(), b.getTitleComponent().getText()));

    gridPane.getChildren().clear();

    for (final AnimeGuiComponentsListEntry entry : guiComponentList) {
        final RowConstraints row = new RowConstraints();
        gridPane.getRowConstraints().add(row);

        gridPane.add(entry.getPictureComponent(), 0, gridPane.getRowConstraints().size() - 1);
        GridPane.setMargin(entry.getPictureComponent(), new Insets(0.0, 0.0, 10.0, 0.0));

        gridPane.add(entry.getTitleComponent(), 1, gridPane.getRowConstraints().size() - 1);
        GridPane.setMargin(entry.getTitleComponent(), new Insets(0.0, 0.0, 10.0, 15.0));

        if (entry.getRemoveButton() != null) {
            gridPane.add(entry.getRemoveButton(), 2, gridPane.getRowConstraints().size() - 1);
            GridPane.setMargin(entry.getRemoveButton(), new Insets(0.0, 0.0, 10.0, 15.0));
        }
    }
}
项目:fellesprosjekt    文件:MonthCalendarComponent.java   
public void drawCurrentPeriod() {
    ArrayList<LocalDate> days = getCalendarDays(this.year, this.month);
    calendarGrid.getChildren().removeAll(calendarSquares);
    calendarGrid.getRowConstraints().removeAll(squareRowConstraints);
    calendarSquares = new ArrayList<>();

    for (int i = 0; i < days.size() / 7; i++) {
        RowConstraints r = new RowConstraints();
        r.setMinHeight(100);
        r.setVgrow(Priority.ALWAYS);
        squareRowConstraints.add(r);
        calendarGrid.getRowConstraints().add(r);

        for (int j = 0; j < 7; j++) {
            MonthCalendarSquare square = new MonthCalendarSquare(days.get(j + i * 7), this.month);

            if (j == 0) {
                square.getStyleClass().add("first-in-row");
            }

            calendarSquares.add(square);
            calendarGrid.add(square, j, i + 1);
        }
    }
}
项目:NoughtPlusPlus    文件:ComputerPlayer.java   
/**
 * Custom cloning of a grid ane
 * @param gridPane The grid pane to clone
 * @return Cloned grid ane
 */
private GridPane cloneGridPane(GridPane gridPane) {
    GridPane clone = new GridPane();

    for (int i = 0; i < gridPane.getColumnConstraints().size(); i++) {
        clone.getColumnConstraints().add(new ColumnConstraints());
        clone.getRowConstraints().add(new RowConstraints());
    }

    //Takes all the CellButtons from the old grid and adds it to the new one
    for (Node n : gridPane.getChildren()) {
        CellButton btn = (CellButton) n;

        CellButton cellBtn = new CellButton(btn.getCoordinate());

        cellBtn.setAttachedPlayer(btn.getAttachedPlayer());
        clone.add(cellBtn, cellBtn.getCoordinate().column(), cellBtn.getCoordinate().row());
    }

    return clone;
}
项目:NoughtPlusPlus    文件:GridPaneLogic.java   
/**
 * Initializes the grid pane that was passed in the constructor
 */
private void initializeGrid() {

    GRID_PANE.getColumnConstraints().clear();
    GRID_PANE.getRowConstraints().clear();

    GRID_PANE.setHgap(5);
    GRID_PANE.setVgap(5);

    GRID_PANE.setPadding(new Insets(5, 5, 5, 5));

    //Adds the columns and rows depending on the grid dimension
    for (int i = 0; i < GRID_DIMENSION; i++) {
        GRID_PANE.getColumnConstraints().add(new ColumnConstraints());
        GRID_PANE.getRowConstraints().add(new RowConstraints());
    }
}
项目:speedment    文件:ConnectController.java   
private void toggleVisibility(RowConstraints row,
                              FilteredList<Node> children,
                              boolean show) {
    if (show) {
        row.setMaxHeight(USE_COMPUTED_SIZE);
        row.setMinHeight(10);
    } else {
        row.setMaxHeight(0);
        row.setMinHeight(0);
    }

    children.forEach(n -> {
        n.setVisible(show);
        n.setManaged(show);
    });
}
项目:rs-timer    文件:MainWindow.java   
/**
 * Adds a tab to the GUI with the specified gridpane information and title.
 * @param gridColumns
 * @param gridRows
 * @param name
 * @return
 */
public Tab addTab(int gridRows, int gridColumns, String name) {
    TimerTab tab = new TimerTab(name);
    tab.setClosable(false);
    GridPane gp = new GridPane();
    gp.setHgap(8);
    gp.setVgap(8);
    gp.getStyleClass().add("gridPane");

    for (int i = 0; i < gridColumns; i++) {
        ColumnConstraints cc = new ColumnConstraints();
        cc.setHgrow(Priority.ALWAYS);
        gp.getColumnConstraints().add(cc);
    }
    for (int i = 0; i < gridRows; i++) {
        RowConstraints rc = new RowConstraints();
        rc.setVgrow(Priority.NEVER);
        gp.getRowConstraints().add(rc);
    }

    tab.setContent(gp);
    tabPane.getTabs().add(tab);
    gp.getChildren().clear();
    return tab;
}
项目:rs-timer    文件:MainWindow.java   
public Tab addDefaultTab() {
    TimerTab tab = new TimerTab(ConfigManager.getInstance().getDefaultTabName());
    tab.setClosable(false);
    GridPane gp = new GridPane();
    gp.setHgap(8);
    gp.setVgap(8);
    gp.getStyleClass().add("gridPane");

    for (int i = 0; i < ConfigManager.getInstance().getDefaultTabColumns(); i++) {
        ColumnConstraints cc = new ColumnConstraints();
        cc.setHgrow(Priority.ALWAYS);
        gp.getColumnConstraints().add(cc);
    }
    for (int i = 0; i < ConfigManager.getInstance().getDefaultTabRows(); i++) {
        RowConstraints rc = new RowConstraints();
        rc.setVgrow(Priority.NEVER);
        gp.getRowConstraints().add(rc);
    }

    tab.setContent(gp);
    tabPane.getTabs().add(tab);
    gp.getChildren().clear();
    return tab;
}
项目:ISAAC    文件:ImportView.java   
/**
 * Sets the FX constraints.
 */
private void setConstraints() {

  // Column 1 has empty constraints.
  this.getColumnConstraints().add(new ColumnConstraints());

  // Column 2 should grow to fill space.
  ColumnConstraints column2 = new ColumnConstraints();
  column2.setHgrow(Priority.ALWAYS);
  this.getColumnConstraints().add(column2);

  // Rows 1-4 have empty constraints.
  this.getRowConstraints().add(new RowConstraints());
  this.getRowConstraints().add(new RowConstraints());
  this.getRowConstraints().add(new RowConstraints());
  this.getRowConstraints().add(new RowConstraints());

  // Row 5 should
  RowConstraints row5 = new RowConstraints();
  row5.setVgrow(Priority.ALWAYS);
  this.getRowConstraints().add(row5);
}
项目:ISAAC    文件:ExportView.java   
/**
 * Sets the FX constraints.
 */
private void setConstraints() {

  // Column 1 has empty constraints.
  this.getColumnConstraints().add(new ColumnConstraints());

  // Column 2 should grow to fill space.
  ColumnConstraints column2 = new ColumnConstraints();
  column2.setHgrow(Priority.ALWAYS);
  this.getColumnConstraints().add(column2);

  // Rows 1-4 have empty constraints.
  this.getRowConstraints().add(new RowConstraints());
  this.getRowConstraints().add(new RowConstraints());
  this.getRowConstraints().add(new RowConstraints());
  this.getRowConstraints().add(new RowConstraints());

  // Row 5 should
  RowConstraints row5 = new RowConstraints();
  row5.setVgrow(Priority.ALWAYS);
  this.getRowConstraints().add(row5);
}
项目:ISAAC    文件:ClassifierView.java   
/**
 * Sets the FX constraints.
 */
private void setConstraints() {

  // Column 1 has empty constraints.
  this.getColumnConstraints().add(new ColumnConstraints());

  // Column 2 should grow to fill space.
  ColumnConstraints column2 = new ColumnConstraints();
  column2.setHgrow(Priority.ALWAYS);
  this.getColumnConstraints().add(column2);

  // Rows 1-4 have empty constraints.
  this.getRowConstraints().add(new RowConstraints());
  this.getRowConstraints().add(new RowConstraints());
  this.getRowConstraints().add(new RowConstraints());
  this.getRowConstraints().add(new RowConstraints());

  // Row 5 should
  RowConstraints row5 = new RowConstraints();
  row5.setVgrow(Priority.ALWAYS);
  this.getRowConstraints().add(row5);
}
项目:javafx-demos    文件:UIControlsDemo3.java   
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;
}
项目:Matcher    文件:Gui.java   
@Override
public void start(Stage stage) {
    Matcher.init();

    env = new ClassEnvironment();
    matcher = new Matcher(env);

    GridPane border = new GridPane();

    ColumnConstraints colConstraint = new ColumnConstraints();
    colConstraint.setPercentWidth(50);
    border.getColumnConstraints().addAll(colConstraint, colConstraint);

    RowConstraints defaultRowConstraints = new RowConstraints();
    RowConstraints contentRowConstraints = new RowConstraints();
    contentRowConstraints.setVgrow(Priority.ALWAYS);
    border.getRowConstraints().addAll(defaultRowConstraints, contentRowConstraints, defaultRowConstraints);

    MainMenuBar menu = new MainMenuBar(this);
    components.add(menu);
    border.add(menu, 0, 0, 2, 1);

    MatchPaneSrc srcPane = new MatchPaneSrc(this);
    components.add(srcPane);
    border.add(srcPane, 0, 1);

    MatchPaneDst dstPane = new MatchPaneDst(this, srcPane);
    components.add(dstPane);
    border.add(dstPane, 1, 1);

    BottomPane bottomPane = new BottomPane(this, srcPane, dstPane);
    components.add(bottomPane);
    border.add(bottomPane, 0, 2, 2, 1);

    scene = new Scene(border);
    stage.setScene(scene);
    stage.setTitle("Matcher");
    stage.show();
}
项目:jedai-ui    文件:ConfirmController.java   
/**
 * Add a new row to the grid, with a label and value. For each new row, an empty RowConstaints object is created.
 *
 * @param rowIndex Index to add row
 * @param label    Label node of row
 * @param value    Value node of row
 * @return RowConstraints object for the newly added row
 */
private RowConstraints addRow(int rowIndex, Label label, Node value) {
    // Set padding on the label
    label.setPadding(new Insets(vGap, 0, vGap, 0));

    // Add the new row
    paramsGrid.addRow(rowIndex, label, value);

    // Create the row constraints for it
    RowConstraints rowConstraints = new RowConstraints();
    paramsGrid.getRowConstraints().add(rowConstraints);

    return rowConstraints;
}
项目:fx-dialogs    文件:FxDialog.java   
private void createGridRow(Label label, TextField textField, Field field) {
    final int gridShift = MODEL.getFields().size();
    GRID.add(label, 0, gridShift);
    GridPane.setHalignment(label, HPos.RIGHT);
    GRID.add(textField, 1, gridShift);
    //
    final RowConstraints row = new RowConstraints();
    row.setFillHeight(true);
    row.setVgrow(Priority.NEVER);
    GRID.getRowConstraints().add(row);
}
项目:SensorThingsManager    文件:EntityGuiController.java   
public static <T extends Node> T addFieldTo(GridPane gp, int row, String title, T node, boolean fillHeight, boolean editable) {
    gp.getRowConstraints().add(new RowConstraints(Region.USE_PREF_SIZE, Region.USE_COMPUTED_SIZE, Region.USE_PREF_SIZE, Priority.NEVER, VPos.BASELINE, fillHeight));
    gp.add(new Label(title), 0, row);
    gp.add(node, 1, row);
    if (node instanceof TextArea) {
        ((TextArea) node).setPrefRowCount(4);
    }
    if (node instanceof TextInputControl) {
        ((TextInputControl) node).setEditable(editable);
    } else {
        node.setDisable(!editable);
    }
    return node;
}
项目:FastisFX    文件:TimeAxis.java   
/**
 * Creates or updates the actual layout of the time axis.
 * The layout can either be horizontal or vertical.
 * The GridView is populated with columns/rows and labels are added accordingly.
 * The labels show the time between this.timeStartProperty and this.timeEndProperty with
 * this.timeStepsProperty in between.
 * The time is formatted according to this.formatter.
 */
private void createLabels() {
    this.getChildren().clear();
    this.getRowConstraints().clear();
    this.getColumnConstraints().clear();

    for(LocalTime currentTime = getTimeStartProperty().get();
        currentTime.isBefore(getTimeEndProperty().get()); ) {

        // create a new label with the time
        Label lblTime = new Label();
        lblTime.setText(currentTime.format(getFormatter()));
        lblTime.getStyleClass().add("time-axis-label");

        // create a new row/column and add the label to it
        if(horizontal) {
            // center the label
            lblTime.widthProperty().addListener(o -> lblTime.setTranslateX( -lblTime.widthProperty().getValue() / 2));

            ColumnConstraints column = new ColumnConstraints(0, USE_COMPUTED_SIZE, Double.POSITIVE_INFINITY, Priority.SOMETIMES, HPos.LEFT, true);
            this.getColumnConstraints().add(column);
            this.add(lblTime, this.getColumnConstraints().size() - 1, 0);
        } else {
            // center the label
            lblTime.heightProperty().addListener(o -> lblTime.setTranslateY( -lblTime.heightProperty().getValue() / 2));
            RowConstraints row = new RowConstraints(0, USE_COMPUTED_SIZE, Double.POSITIVE_INFINITY, Priority.SOMETIMES, VPos.TOP, true);
            this.getRowConstraints().add(row);
            this.add(lblTime, 0, this.getRowConstraints().size() - 1);
        }

        // prevent overflows at midnight
        LocalTime newTime = currentTime.plusMinutes(getTimeStepsProperty().get().toMinutes());
        if(newTime.isAfter(currentTime)) {
            currentTime = newTime;
        } else {
            break;
        }
    }
}
项目:shuffleboard    文件:TilePane.java   
private RowConstraints createRowConstraint() {
  RowConstraints constraints = new RowConstraints(
      MIN_TILE_SIZE, getTileSize(), Region.USE_PREF_SIZE, Priority.NEVER, VPos.CENTER, true);
  constraints.minHeightProperty().bind(tileSize);
  constraints.prefHeightProperty().bind(tileSize);
  constraints.maxHeightProperty().bind(tileSize);
  return constraints;
}
项目:CalendarFX    文件:YearMonthViewSkin.java   
private void updateVisibility() {
    for (int row = 0; row < 6; row++) {
        RowConstraints rowConstraints = new RowConstraints();
        rowConstraints.setFillHeight(true);
        rowConstraints.setMinHeight(Region.USE_PREF_SIZE);
        rowConstraints.setMaxHeight(Region.USE_COMPUTED_SIZE);
        rowConstraints.setPrefHeight(Region.USE_COMPUTED_SIZE);
        rowConstraints.setVgrow(Priority.ALWAYS);
        gridPane.getRowConstraints().add(rowConstraints);
    }

    ColumnConstraints weekColumn = new ColumnConstraints();
    weekColumn.setHalignment(HPos.RIGHT);
    weekColumn.setMaxWidth(Region.USE_COMPUTED_SIZE);
    weekColumn.setMinWidth(Region.USE_PREF_SIZE);
    weekColumn.setPrefWidth(Region.USE_COMPUTED_SIZE);
    weekColumn.setFillWidth(true);
    weekColumn.setHgrow(Priority.NEVER);
    gridPane.getColumnConstraints().add(weekColumn);

    for (int col = 0; col < 7; col++) {
        ColumnConstraints columnConstraints = new ColumnConstraints();
        columnConstraints.setHalignment(HPos.CENTER);
        columnConstraints.setMaxWidth(Region.USE_COMPUTED_SIZE);
        columnConstraints.setMinWidth(Region.USE_PREF_SIZE);
        columnConstraints.setPrefWidth(Region.USE_COMPUTED_SIZE);
        columnConstraints.setFillWidth(true);
        columnConstraints.setHgrow(Priority.ALWAYS);
        gridPane.getColumnConstraints().add(columnConstraints);
    }
}
项目:CalendarFX    文件:YearViewSkin.java   
public YearViewSkin(YearView view) {
    super(view);

    view.dateProperty().addListener(evt -> updateMonths());

    GridPane gridPane = new GridPane();
    gridPane.getStyleClass().add("container");
    gridPane.setMaxSize(MAX_VALUE, MAX_VALUE);

    for (int row = 0; row < 3; row++) {
        RowConstraints rowConstraints = new RowConstraints();
        rowConstraints.setMinHeight(Region.USE_PREF_SIZE);
        rowConstraints.setPrefHeight(Region.USE_COMPUTED_SIZE);
        rowConstraints.setMaxHeight(Region.USE_COMPUTED_SIZE);
        rowConstraints.setVgrow(Priority.ALWAYS);
        rowConstraints.setValignment(VPos.CENTER);
        gridPane.getRowConstraints().add(rowConstraints);
    }

    for (int col = 0; col < 4; col++) {
        ColumnConstraints colConstraints = new ColumnConstraints();
        colConstraints.setMinWidth(Region.USE_PREF_SIZE);
        colConstraints.setPrefWidth(Region.USE_COMPUTED_SIZE);
        colConstraints.setMaxWidth(Region.USE_COMPUTED_SIZE);
        colConstraints.setHgrow(Priority.ALWAYS);
        colConstraints.setHalignment(HPos.CENTER);
        gridPane.getColumnConstraints().add(colConstraints);
    }

    for (int row = 0; row < 3; row++) {
        for (int col = 0; col < 4; col++) {
            Month month = Month.of(row * 4 + col + 1);

            YearMonthView yearMonthView = view.getMonthView(month);
            yearMonthView.setShowMonthArrows(false);
            yearMonthView.setShowTodayButton(false);
            yearMonthView.setShowUsageColors(true);
            yearMonthView.setClickBehaviour(YearMonthView.ClickBehaviour.SHOW_DETAILS);
            gridPane.add(yearMonthView, col, row);

            // do not bind date, we manage it manually
            view.bind(yearMonthView, false);
        }
    }

    getChildren().add(gridPane);

    updateMonths();
}
项目:CalendarFX    文件:DayPageSkin.java   
@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;
}
项目:GazePlay    文件:Circles_handler.java   
@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());


}
项目:GazePlay    文件:Circles_points_handler.java   
@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());


}
项目:GazePlay    文件:Circles_points_handler2.java   
@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());


}
项目:HTTP-Load-Generator    文件:ScriptTestWindow.java   
private void initializeGrid() {
    grid = new GridPane();
    //grid.setAlignment(Pos.CENTER);
    grid.setHgap(10);
    grid.setVgap(10);
    grid.setPadding(new Insets(25, 25, 25, 25));
    grid.setMaxSize(Region.USE_COMPUTED_SIZE, Region.USE_COMPUTED_SIZE);
    ColumnConstraints c1 = new ColumnConstraints();
    c1.setFillWidth(true);
    c1.setHgrow(Priority.ALWAYS);
    grid.getColumnConstraints().addAll(new ColumnConstraints(), c1, new ColumnConstraints());
    RowConstraints r2 = new RowConstraints();
    r2.setFillHeight(true);
    r2.setVgrow(Priority.ALWAYS);
}
项目:cassandra-client    文件:EventLogger.java   
public EventLogger() {
    setVisible(false);
    setPrefHeight(30);
    setPrefWidth(612);

    ColumnConstraints column1 = new ColumnConstraints();
    column1.setPercentWidth(85);
    column1.setHgrow(Priority.SOMETIMES);

    ColumnConstraints column2 = new ColumnConstraints();
    column2.setPercentWidth(15);
    column2.setHgrow(Priority.SOMETIMES);

    getColumnConstraints().clear();
    getColumnConstraints().addAll(column1, column2);

    RowConstraints row = new RowConstraints(10, 40, 40);
    row.setVgrow(Priority.SOMETIMES);

    getRowConstraints().clear();
    getRowConstraints().add(row);

    eventLabel = buildEventLabel();
    setConstraints(eventLabel, 0, 0);
    GridPane.setMargin(eventLabel, new Insets(0, 10, 0, 10));

    serverLabel = new Label();
    setConstraints(serverLabel, 1, 0);
    GridPane.setMargin(serverLabel, new Insets(0, 10, 0, 10));
    getChildren().addAll(eventLabel, serverLabel);
}
项目:Modul-326-Labyrinth-Editor    文件:EditorController.java   
private void initializeEditorCanvas() {
    //reset canvas from eventual previous labyrinths
    resetCanvas();

    //make sure we know the current size
    updateCanvasSize();

    //calculate the TILE_SIZE appropriate for the window size and size of the Labyrinth
    int smallerCanvasDimension = Integer.min(CANVAS_HEIGHT, CANVAS_WIDTH) - 2 * MARGIN;
    int largerLabyrinthDimension = Integer.max(labyrinth.getHeight(), labyrinth.getWidth());

    TILE_SIZE = smallerCanvasDimension / largerLabyrinthDimension;


    //set size of the GridView
    RowConstraints rowConstraints = new RowConstraints();
    rowConstraints.setPrefHeight(TILE_SIZE);
    rowConstraints.setMinHeight(TILE_SIZE);
    rowConstraints.setMaxHeight(TILE_SIZE);

    for (int rowIndex = 0; rowIndex < labyrinth.getHeight(); rowIndex++) {
        canvasGridPane.addRow(rowIndex);
        canvasGridPane.getRowConstraints().add(rowConstraints);
    }

    ColumnConstraints columnConstraints = new ColumnConstraints();
    columnConstraints.setPrefWidth(TILE_SIZE);
    columnConstraints.setMinWidth(TILE_SIZE);
    columnConstraints.setMaxWidth(TILE_SIZE);

    for (int colIndex = 0; colIndex < labyrinth.getWidth(); colIndex++) {
        canvasGridPane.addRow(colIndex);
        canvasGridPane.getColumnConstraints().add(columnConstraints);
    }
}