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

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

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

Node.setStyle介绍

暂无

代码示例

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

  1. private void setColorAtLocation(int x, int y) {
  2. if (allowColorChange) {
  3. Color color = getColorAtLocation(x, y);
  4. String colorString = "rgb(" + color.getRed() * 255 + "," + color.getGreen() * 255 + "," + color.getBlue() * 255 + ");";
  5. for (Node node : colorNodes)
  6. node.setStyle("-fx-background-color:" + colorString + "; -fx-fill:" + colorString+";");
  7. }
  8. }

代码示例来源:origin: stackoverflow.com

  1. datad.nodeProperty().addListener(new ChangeListener<Node>() {
  2. @Override
  3. public void changed(ObservableValue<? extends Node> ov, Node oldNode, Node newNode) {
  4. newNode.setStyle("-fx-bar-fill: red;");
  5. }
  6. });

代码示例来源:origin: stackoverflow.com

  1. final XYChart.Data<String, Number> data = new XYChart.Data("Value " + i , i);
  2. data.nodeProperty().addListener(new ChangeListener<Node>() {
  3. @Override public void changed(ObservableValue<? extends Node> ov, Node oldNode, Node newNode) {
  4. if (newNode != null) {
  5. if (data.getYValue().intValue() > 8 ) {
  6. newNode.setStyle("-fx-bar-fill: navy;");
  7. } else if (data.getYValue().intValue() > 5 ) {
  8. newNode.setStyle("-fx-bar-fill: firebrick;");
  9. }
  10. }
  11. }
  12. });

代码示例来源:origin: stackoverflow.com

  1. ArrayList<Node> seriesNodes = new ArrayList<Node>();
  2. Set<Node> nodes = scatterChart.lookupAll(.series0);
  3. int flag=0;
  4. for (Node n : nodes) {
  5. n.setStyle("-fx-blend-mode: multiply ;");
  6. if(flag==0){
  7. seriesNodes.add(n);
  8. }
  9. flag++;
  10. }

代码示例来源:origin: stackoverflow.com

  1. data.nodeProperty().addListener(new ChangeListener<Node>() {
  2. @Override
  3. public void changed(ObservableValue<? extends Node> ov, Node oldNode, final Node node) {
  4. if (node != null ) {
  5. node.setStyle(String.format("-fx-background-color: %s;", color));
  6. }
  7. }
  8. }

代码示例来源:origin: stackoverflow.com

  1. Platform.runLater(new Runnable() {
  2. @Override
  3. public void run() {
  4. for (int i = 0; i < usedColors.size(); i++) {
  5. for (Node node : chart.lookupAll(String.format(".default-color%d.chart-pie", i))) {
  6. node.setStyle(String.format("-fx-pie-color: #%06x;", usedColors.get(i)));
  7. }
  8. }
  9. }
  10. });

代码示例来源:origin: org.codehaus.griffon/griffon-javafx

  1. public static void setStyle(@Nonnull Node node, @Nonnull String style) {
  2. requireNonNull(node, ERROR_CONTROL_NULL);
  3. if (isBlank(style)) { return; }
  4. if (style.startsWith("&")) {
  5. // append style
  6. String nodeStyle = node.getStyle();
  7. node.setStyle(nodeStyle + (nodeStyle.endsWith(";") ? "" : ";") + style.substring(1));
  8. } else {
  9. node.setStyle(style);
  10. }
  11. }

代码示例来源:origin: stackoverflow.com

  1. XYChart chart = new AreaChart();
  2. Series series = new Series();
  3. chart.getData().add(series);
  4. Node fill = series.getNode().lookup(".chart-series-area-fill"); // only for AreaChart
  5. Node line = series.getNode().lookup(".chart-series-area-line");
  6. Color color = Color.RED; // or any other color
  7. String rgb = String.format("%d, %d, %d",
  8. (int) (color.getRed() * 255),
  9. (int) (color.getGreen() * 255),
  10. (int) (color.getBlue() * 255));
  11. fill.setStyle("-fx-fill: rgba(" + rgb + ", 0.15);");
  12. line.setStyle("-fx-stroke: rgba(" + rgb + ", 1.0);");

代码示例来源:origin: ch.sahits.game/OpenPatricianJavaFX

  1. @Override
  2. public void applyStyle(String style) {
  3. for (Node node : getChildren()) {
  4. if (node instanceof IApplicableStyle) {
  5. ((IApplicableStyle)node).applyStyle(style);
  6. } else {
  7. node.setStyle(style);
  8. }
  9. }
  10. }
  11. }

代码示例来源:origin: ch.sahits.game/OpenPatricianJavaFX

  1. @Override
  2. public void applyStyle(String style) {
  3. for (Node node : getChildren()) {
  4. if (node instanceof IApplicableStyle) {
  5. ((IApplicableStyle)node).applyStyle(style);
  6. } else {
  7. node.setStyle(style);
  8. }
  9. }
  10. }

代码示例来源:origin: ch.sahits.game/OpenPatricianJavaFX

  1. @Override
  2. public void applyStyle(String style) {
  3. for (Node node : getChildren()) {
  4. if (node instanceof IApplicableStyle) {
  5. ((IApplicableStyle)node).applyStyle(style);
  6. } else {
  7. node.setStyle(style);
  8. }
  9. }
  10. }
  11. }

代码示例来源:origin: ch.sahits.game/OpenPatricianJavaFX

  1. @Override
  2. public void applyStyle(String style) {
  3. for (Node node : getChildren()) {
  4. if (node instanceof IApplicableStyle) {
  5. ((IApplicableStyle)node).applyStyle(style);
  6. } else {
  7. node.setStyle(style);
  8. }
  9. }
  10. }
  11. }

代码示例来源:origin: ch.sahits.game/OpenPatricianJavaFX

  1. @Override
  2. public void applyStyle(String style) {
  3. for (Node node : getChildren()) {
  4. if (node instanceof IApplicableStyle) {
  5. ((IApplicableStyle)node).applyStyle(style);
  6. } else {
  7. node.setStyle(style);
  8. }
  9. }
  10. }
  11. }

代码示例来源:origin: ch.sahits.game/OpenPatricianJavaFX

  1. @Override
  2. public void applyStyle(String style) {
  3. for (Node node : getChildren()) {
  4. if (node instanceof IApplicableStyle) {
  5. ((IApplicableStyle)node).applyStyle(style);
  6. } else {
  7. node.setStyle(style);
  8. }
  9. }
  10. }
  11. }

代码示例来源:origin: ch.sahits.game/OpenPatricianJavaFX

  1. @Override
  2. public void applyStyle(String style) {
  3. for (Node node : getChildren()) {
  4. if (node instanceof IApplicableStyle) {
  5. ((IApplicableStyle)node).applyStyle(style);
  6. } else {
  7. node.setStyle(style);
  8. }
  9. }
  10. }
  11. }

代码示例来源:origin: GoMint/GoMint

  1. public Node getNode() {
  2. this.chart.getData().addAll( this.actualTimeSeries, this.fullTimeSeries, this.averageTimeSeries );
  3. this.chart.setPrefHeight( 200 );
  4. this.fullTimeSeries.getNode().setStyle( "-fx-stroke-width: 2px; -fx-stroke: #f34602;" );
  5. this.actualTimeSeries.getNode().setStyle( "-fx-stroke-width: 2px; -fx-stroke: #f39502;" );
  6. this.averageTimeSeries.getNode().setStyle( "-fx-stroke-width: 2px; -fx-stroke: #45df02;" );
  7. updateChart();
  8. return this.chart;
  9. }

代码示例来源:origin: stackoverflow.com

  1. @Override
  2. public void start(Stage primaryStage) {
  3. SplitPane split = new SplitPane();
  4. ...
  5. Scene scene = new Scene(split);
  6. primaryStage.setScene(scene);
  7. primaryStage.show();
  8. Node divider = split.lookup(".split-pane-divider");
  9. if(divider!=null){
  10. divider.setStyle("-fx-background-color: transparent;");
  11. }
  12. }

代码示例来源:origin: com.aquafx-project/aquafx

  1. @Override public void handle(ActionEvent event) {
  2. alreadyFaded = false;
  3. alreadyHovered = false;
  4. wide = false;
  5. getSkinnable().setStyle(null);
  6. for (Node child : getChildren()) {
  7. child.setStyle(null);
  8. }
  9. }
  10. });

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

  1. private void setColorAtLocation(int x, int y) {
  2. if (allowColorChange) {
  3. Color color = getColorAtLocation(x, y);
  4. String colorString = "rgb(" + color.getRed() * 255 + "," + color.getGreen() * 255 + "," + color.getBlue() * 255 + ");";
  5. for (Node node : colorNodes)
  6. node.setStyle("-fx-background-color:" + colorString + "; -fx-fill:" + colorString+";");
  7. }
  8. }

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

  1. private Node createDecorationNode(ValidationMessage message) {
  2. Node graphic = Severity.ERROR == message.getSeverity() ? createErrorNode() : createWarningNode();
  3. graphic.setStyle(SHADOW_EFFECT);
  4. Label label = new Label();
  5. label.setGraphic(graphic);
  6. label.setTooltip(createTooltip(message));
  7. label.setAlignment(Pos.CENTER);
  8. return label;
  9. }

相关文章

Node类方法