當前位置: 首頁>>代碼示例>>Java>>正文


Java Node.pseudoClassStateChanged方法代碼示例

本文整理匯總了Java中javafx.scene.Node.pseudoClassStateChanged方法的典型用法代碼示例。如果您正苦於以下問題:Java Node.pseudoClassStateChanged方法的具體用法?Java Node.pseudoClassStateChanged怎麽用?Java Node.pseudoClassStateChanged使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javafx.scene.Node的用法示例。


在下文中一共展示了Node.pseudoClassStateChanged方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: updateColumns

import javafx.scene.Node; //導入方法依賴的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

示例2: suppressFocusStyle

import javafx.scene.Node; //導入方法依賴的package包/類
private static void suppressFocusStyle(Node node) {
    if (!node.isFocused()) {
        node.pseudoClassStateChanged(FOCUS_SUPRESSED_PSEUDO_CLASS, true);
    }
}
 
開發者ID:rmfisher,項目名稱:fx-animation-editor,代碼行數:6,代碼來源:FocusHelper.java

示例3: endSuppressionIfFocusLost

import javafx.scene.Node; //導入方法依賴的package包/類
private static void endSuppressionIfFocusLost(Node node) {
    if (!node.isFocused() && node.getScene() != null && node.getScene().getFocusOwner() != node) {
        node.pseudoClassStateChanged(FOCUS_SUPRESSED_PSEUDO_CLASS, false);
    }
}
 
開發者ID:rmfisher,項目名稱:fx-animation-editor,代碼行數:6,代碼來源:FocusHelper.java


注:本文中的javafx.scene.Node.pseudoClassStateChanged方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。