javafx.scene.Node.applyCss()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(6.6k)|赞(0)|评价(0)|浏览(113)

本文整理了Java中javafx.scene.Node.applyCss()方法的一些代码示例,展示了Node.applyCss()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Node.applyCss()方法的具体详情如下:
包路径:javafx.scene.Node
类名称:Node
方法名:applyCss

Node.applyCss介绍

暂无

代码示例

代码示例来源:origin: jfoenixadmin/JFoenix

private void updateDisclosureNode() {
  Node disclosureNode = ((JFXTreeTableCell<S, T>) getSkinnable()).getDisclosureNode();
  if (disclosureNode != null) {
    TreeItem<S> item = getSkinnable().getTreeTableRow().getTreeItem();
    final S value = item == null ? null : item.getValue();
    boolean disclosureVisible = value != null
                  && !item.isLeaf()
                  && value instanceof RecursiveTreeObject
                  && ((RecursiveTreeObject) value).getGroupedColumn() == getSkinnable().getTableColumn();
    disclosureNode.setVisible(disclosureVisible);
    if (!disclosureVisible) {
      getChildren().remove(disclosureNode);
    } else if (disclosureNode.getParent() == null) {
      getChildren().add(disclosureNode);
      disclosureNode.toFront();
    } else {
      disclosureNode.toBack();
    }
    if (disclosureNode.getScene() != null) {
      disclosureNode.applyCss();
    }
  }
}

代码示例来源:origin: org.controlsfx/controlsfx

private void addLocation(WorldMapView.Location location) {
  Point2D coordinates = getLocationCoordinates(location);
  Callback<WorldMapView.Location, Node> locationViewFactory = getSkinnable().getLocationViewFactory();
  Node view = locationViewFactory.call(location);
  if (view == null) {
    throw new IllegalArgumentException("location view factory returned NULL");
  }
  view.getStyleClass().add(DEFAULT_STYLE_LOCATION);
  view.setManaged(false);
  locationsGroup.getChildren().add(view);
  view.applyCss();
  view.resizeRelocate(coordinates.getX(), coordinates.getY(), view.prefWidth(-1), view.prefHeight(-1));
  locationMap.put(location, view);
}

代码示例来源:origin: org.fxmisc.flowless/flowless

private C cellForItem(T item) {
  C cell = cellPool.getCell(item);
  // apply CSS when the cell is first added to the scene
  Node node = cell.getNode();
  EventStreams.nonNullValuesOf(node.sceneProperty())
      .subscribeForOne(scene -> {
        node.applyCss();
      });
  // Make cell initially invisible.
  // It will be made visible when it is positioned.
  node.setVisible(false);
  if (cell.isReusable()) {
    // if cell is reused i think adding event handler
    // would cause resource leakage.
    node.setOnScroll(this::pushScrollEvent);
    node.setOnScrollStarted(this::pushScrollEvent);
    node.setOnScrollFinished(this::pushScrollEvent);
  } else {
    node.addEventHandler(ScrollEvent.ANY, this::pushScrollEvent);
  }
  return cell;
}

代码示例来源:origin: com.jfoenix/jfoenix

private void updateDisclosureNode() {
  Node disclosureNode = ((JFXTreeTableCell<S, T>) getSkinnable()).getDisclosureNode();
  if (disclosureNode != null) {
    TreeItem<S> item = getSkinnable().getTreeTableRow().getTreeItem();
    final S value = item == null ? null : item.getValue();
    boolean disclosureVisible = value != null
                  && !item.isLeaf()
                  && value instanceof RecursiveTreeObject
                  && ((RecursiveTreeObject) value).getGroupedColumn() == getSkinnable().getTableColumn();
    disclosureNode.setVisible(disclosureVisible);
    if (!disclosureVisible) {
      getChildren().remove(disclosureNode);
    } else if (disclosureNode.getParent() == null) {
      getChildren().add(disclosureNode);
      disclosureNode.toFront();
    } else {
      disclosureNode.toBack();
    }
    if (disclosureNode.getScene() != null) {
      disclosureNode.applyCss();
    }
  }
}

代码示例来源:origin: org.controlsfx/controlsfx

node.applyCss();

代码示例来源:origin: at.bestsolution.efxclipse.rt/org.eclipse.fx.ui.controls

@SuppressWarnings("null")
@Override
protected Node createWindowArea() {
  BorderPane root = new BorderPane();
  getStyleClass().addAll("default-window", "decorated-root"); //$NON-NLS-1$ //$NON-NLS-2$
  Node dialogTitleBar = createTitleBar();
  this.dialogAreaNode = (TitleAreaNode) dialogTitleBar;
  registerTitleBar(dialogTitleBar);
  this.titleProperty = ((TitleAreaNode) dialogTitleBar).titleProperty();
  root.setTop(dialogTitleBar);
  dialogTitleBar.applyCss();
  sceneProperty().addListener((o) -> {
    Scene s = getScene();
    if (s != null) {
      if (s.getWindow() != null) {
        handleStageAttached();
      } else {
        s.windowProperty().addListener((o2) -> {
          if (s.getWindow() != null) {
            handleStageAttached();
          }
        });
      }
    }
  });
  this.trimPane = new BorderPane();
  root.setCenter(this.trimPane);
  this.contentProperty = this.trimPane.centerProperty();
  return root;
}

代码示例来源:origin: at.bestsolution.eclipse/org.eclipse.fx.ui.controls

@SuppressWarnings("null")
@Override
protected Node createWindowArea() {
  BorderPane root = new BorderPane();
  getStyleClass().addAll("default-window", "decorated-root"); //$NON-NLS-1$ //$NON-NLS-2$
  Node dialogTitleBar = createTitleBar();
  this.dialogAreaNode = (TitleAreaNode) dialogTitleBar;
  registerTitleBar(dialogTitleBar);
  this.titleProperty = ((TitleAreaNode) dialogTitleBar).titleProperty();
  root.setTop(dialogTitleBar);
  dialogTitleBar.applyCss();
  sceneProperty().addListener((o) -> {
    Scene s = getScene();
    if (s != null) {
      if (s.getWindow() != null) {
        handleStageAttached();
      } else {
        s.windowProperty().addListener((o2) -> {
          if (s.getWindow() != null) {
            handleStageAttached();
          }
        });
      }
    }
  });
  this.trimPane = new BorderPane();
  root.setCenter(this.trimPane);
  this.contentProperty = this.trimPane.centerProperty();
  return root;
}

代码示例来源:origin: at.bestsolution.efxclipse.rt/org.eclipse.fx.ui.controls

@SuppressWarnings("null")
@Override
protected Node createWindowArea() {
  BorderPane root = new BorderPane();
  getStyleClass().addAll("default-window", "decorated-root"); //$NON-NLS-1$ //$NON-NLS-2$
  Node dialogTitleBar = createTitleBar();
  this.dialogAreaNode = (TitleAreaNode) dialogTitleBar;
  registerTitleBar(dialogTitleBar);
  this.titleProperty = ((TitleAreaNode) dialogTitleBar).titleProperty();
  root.setTop(dialogTitleBar);
  dialogTitleBar.applyCss();
  sceneProperty().addListener((o) -> {
    Scene s = getScene();
    if (s != null) {
      if (s.getWindow() != null) {
        handleStageAttached();
      } else {
        s.windowProperty().addListener((o2) -> {
          if (s.getWindow() != null) {
            handleStageAttached();
          }
        });
      }
    }
  });
  this.trimPane = new BorderPane();
  root.setCenter(this.trimPane);
  this.contentProperty = this.trimPane.centerProperty();
  return root;
}

代码示例来源:origin: at.bestsolution.eclipse/org.eclipse.fx.ui.controls

@SuppressWarnings("null")
@Override
protected Node createWindowArea() {
  BorderPane root = new BorderPane();
  getStyleClass().addAll("default-window", "decorated-root"); //$NON-NLS-1$ //$NON-NLS-2$
  Node dialogTitleBar = createTitleBar();
  this.dialogAreaNode = (TitleAreaNode) dialogTitleBar;
  registerTitleBar(dialogTitleBar);
  this.titleProperty = ((TitleAreaNode) dialogTitleBar).titleProperty();
  root.setTop(dialogTitleBar);
  dialogTitleBar.applyCss();
  sceneProperty().addListener((o) -> {
    Scene s = getScene();
    if (s != null) {
      if (s.getWindow() != null) {
        handleStageAttached();
      } else {
        s.windowProperty().addListener((o2) -> {
          if (s.getWindow() != null) {
            handleStageAttached();
          }
        });
      }
    }
  });
  this.trimPane = new BorderPane();
  root.setCenter(this.trimPane);
  this.contentProperty = this.trimPane.centerProperty();
  return root;
}

相关文章

微信公众号

最新文章

更多

Node类方法