當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。