当前位置: 首页>>代码示例>>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;未经允许,请勿转载。