当前位置: 首页>>代码示例>>Java>>正文


Java GridPane.setFillHeight方法代码示例

本文整理汇总了Java中javafx.scene.layout.GridPane.setFillHeight方法的典型用法代码示例。如果您正苦于以下问题:Java GridPane.setFillHeight方法的具体用法?Java GridPane.setFillHeight怎么用?Java GridPane.setFillHeight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javafx.scene.layout.GridPane的用法示例。


在下文中一共展示了GridPane.setFillHeight方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: updateControl

import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
private void updateControl() {
    pane.getChildren().clear();
    pane.getColumnConstraints().clear();

    // the day views
    WeekDayHeaderView view = getSkinnable();
    final int numberOfDays = view.getNumberOfDays();

    Callback<WeekDayHeaderView, WeekDayCell> cellFactory = view.getCellFactory();
    for (int i = 0; i < numberOfDays; i++) {
        ColumnConstraints con = new ColumnConstraints();
        con.setPercentWidth((double) 100 / (double) numberOfDays);
        pane.getColumnConstraints().add(con);
        WeekDayCell cell = cellFactory.call(view);
        GridPane.setHgrow(cell, Priority.ALWAYS);
        GridPane.setVgrow(cell, Priority.ALWAYS);
        GridPane.setFillHeight(cell, true);
        GridPane.setFillWidth(cell, true);

        final int dayCount = i;
        /*
         * TODO: listener must be removed when number of days change.
         */
        view.dateProperty().addListener(evt -> updateCell(cell, dayCount));
        updateCell(cell, dayCount);

        pane.add(cell, i, 0);
    }
}
 
开发者ID:dlemmermann,项目名称:CalendarFX,代码行数:30,代码来源:WeekDayHeaderViewSkin.java

示例2: updateBackgrounds

import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
private void updateBackgrounds() {
    // the day views

    pane.getChildren().clear();
    List<ColumnConstraints> constraints = new ArrayList<>();

    int numberOfDays = getSkinnable().getNumberOfDays();
    for (int i = 0; i < numberOfDays; i++) {
        ColumnConstraints con = new ColumnConstraints();
        con.setPercentWidth((double) 100 / (double) numberOfDays);
        constraints.add(con);
        Region region = new Region();
        region.setMaxWidth(Double.MAX_VALUE);
        region.getStyleClass().add(ALL_DAY_BACKGROUND_REGION);
        GridPane.setHgrow(region, Priority.ALWAYS);
        GridPane.setVgrow(region, Priority.ALWAYS);
        GridPane.setFillHeight(region, true);
        GridPane.setFillWidth(region, true);

        final int day = i;
        getSkinnable().dateProperty().addListener(evt -> updateRegion(region, day));
        updateRegion(region, day);

        pane.add(region, i, 0);
    }

    pane.getColumnConstraints().setAll(constraints);

    getSkinnable().requestLayout();
}
 
开发者ID:dlemmermann,项目名称:CalendarFX,代码行数:31,代码来源:AllDayViewSkin.java

示例3: updateColumns

import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
private void updateColumns() {
    pane.getChildren().clear();

    final CalendarHeaderView headerView = getSkinnable();
    if (headerView.isVisible()) {
        Callback<Calendar, Node> factory = headerView.getCellFactory();

        List<ColumnConstraints> weekConstraints = new ArrayList<>();

        int numberOfDays = headerView.getNumberOfDays();
        for (int i = 0; i < numberOfDays; i++) {
            ColumnConstraints con = new ColumnConstraints();
            con.setPercentWidth((double) 100 / (double) numberOfDays);
            weekConstraints.add(con);

            GridPane dayGridPane = new GridPane();
            dayGridPane.setMaxWidth(Double.MAX_VALUE);
            GridPane.setHgrow(dayGridPane, Priority.ALWAYS);
            GridPane.setVgrow(dayGridPane, Priority.ALWAYS);
            GridPane.setFillHeight(dayGridPane, true);
            GridPane.setFillWidth(dayGridPane, true);

            List<ColumnConstraints> dayConstraints = new ArrayList<>();

            /*
             * We only care about visible calendars.
             */
            List<Calendar> calendars = headerView.getCalendars().stream()
                    .filter(headerView::isCalendarVisible)
                    .collect(Collectors.toList());

            int calendarCount = calendars.size();

            double columnWidth = (double) 100 / (double) calendarCount;

            for (int j = 0; j < calendarCount; j++) {
                Calendar calendar = calendars.get(j);

                ColumnConstraints calendarConstraint = new ColumnConstraints();
                calendarConstraint.setPercentWidth(columnWidth);
                calendarConstraint.setFillWidth(true);
                calendarConstraint.setHgrow(Priority.ALWAYS);
                dayConstraints.add(calendarConstraint);

                Node calendarLabel = factory.call(calendar);

                calendarLabel.getStyleClass().addAll(
                        "default-style-calendar-header", //$NON-NLS-1$
                        calendar.getStyle() + "-calendar-header"); //$NON-NLS-1$
                dayGridPane.add(calendarLabel, j, 0);

                GridPane.setHgrow(calendarLabel, Priority.ALWAYS);
                GridPane.setVgrow(calendarLabel, Priority.ALWAYS);
                GridPane.setFillHeight(calendarLabel, true);
                GridPane.setFillWidth(calendarLabel, true);

                calendarLabel.pseudoClassStateChanged(FIRST_COLUMN, j == 0);
                calendarLabel.pseudoClassStateChanged(MIDDLE_COLUMN,
                        j > 0 && j < calendarCount - 1);
                calendarLabel.pseudoClassStateChanged(LAST_COLUMN,
                        j == calendarCount - 1);
            }

            dayGridPane.getColumnConstraints().setAll(dayConstraints);

            pane.add(dayGridPane, i, 0);
        }

        pane.getColumnConstraints().setAll(weekConstraints);
    }
}
 
开发者ID:dlemmermann,项目名称:CalendarFX,代码行数:72,代码来源:CalendarHeaderViewSkin.java

示例4: nodeSelector

import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
private void nodeSelector() { 
    weightGrid.getChildren().clear();
    edgesGrid.getChildren().clear();
    label.setText("Select adjacent vertices of '" + vertexValue[counter] + "' and input weight: ");
    vertexGrid.getChildren().clear();

    Label vertexLabel[] = new Label[steps];
    Pane vPane[] = new Pane[steps];
    edges = new JFXTextField[steps];

    for (int i = 0; i < steps; i++) {
        vertexLabel[i] = new Label();
        vPane[i] = new Pane();
        edges[i] = new JFXTextField();

        vertexGrid.add(vPane[i], i, 0);
        vertexLabel[i].setAlignment(Pos.CENTER);
        vertexLabel[i].setText(vertexValue[i]);

        //selector is initialized in initialize() and 
        //will help to select adjacent nodes
        GridPane.setFillHeight(selectors[i], true);
        GridPane.setFillWidth(selectors[i], true);

        selectors[i].setText(vertexValue[i]);
        selectors[i].setTextFill(Color.WHITE);
        selectors[i].setStyle("-fx-background-color: " + colors[i]
                + "; -fx-border-color: #000000;"
                + " -fx-background-radius: 10 10 10 10;"
                + "; -fx-border-radius: 10 10 10 10;");

        selectors[i].setPrefSize(100, 100);

        edgesGrid.add(selectors[i], i, 0);

        GridPane.setHalignment(vertexLabel[i], HPos.CENTER);

        if (i == counter) {
            selectors[i].setDisable(true);
            vertexLabel[i].setTextFill(Color.WHITE);
            vPane[i].setStyle("-fx-background-color: " + colors[i]
                    + "; -fx-border-color: #000000;"
                    + " -fx-background-radius: 10 10 10 10;"
                    + "; -fx-border-radius: 10 10 10 10;");
        } else {
            vertexLabel[i].setTextFill(Color.BLACK);
            vPane[i].setStyle("-fx-background-color: #B2DFDB; -fx-border-color: #000000;");
            selectors[i].setDisable(false);
        }

        //This portion gonna add the edges fields
        edges[i].setFocusColor(Color.web("1A237E"));
        edges[i].setUnFocusColor(Color.web("#4d4d4d"));
        edges[i].setText("∞");

        if (i == counter) {
            edges[i].setText("0");
        }

        edges[i].setAlignment(Pos.CENTER);
        edges[i].setDisable(true);
        weightGrid.add(edges[i], i, 0);

        vertexGrid.add(vertexLabel[i], i, 0);
    }

    // counter++;
}
 
开发者ID:afifaniks,项目名称:FloydWarshallSimulation,代码行数:69,代码来源:ManualInputController.java


注:本文中的javafx.scene.layout.GridPane.setFillHeight方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。