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

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

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

Node.setStyle介绍

暂无

代码示例

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

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

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

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

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

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

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

ArrayList<Node> seriesNodes = new ArrayList<Node>();
Set<Node> nodes = scatterChart.lookupAll(.series0); 
          int flag=0;
          for (Node n : nodes) {
            n.setStyle("-fx-blend-mode: multiply ;");
             if(flag==0){
               seriesNodes.add(n);
             }
             flag++;
          }

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

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

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

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

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

public static void setStyle(@Nonnull Node node, @Nonnull String style) {
  requireNonNull(node, ERROR_CONTROL_NULL);
  if (isBlank(style)) { return; }
  if (style.startsWith("&")) {
    // append style
    String nodeStyle = node.getStyle();
    node.setStyle(nodeStyle + (nodeStyle.endsWith(";") ? "" : ";") + style.substring(1));
  } else {
    node.setStyle(style);
  }
}

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

XYChart chart = new AreaChart();
Series series = new Series();
chart.getData().add(series);

Node fill = series.getNode().lookup(".chart-series-area-fill"); // only for AreaChart
Node line = series.getNode().lookup(".chart-series-area-line");

Color color = Color.RED; // or any other color

String rgb = String.format("%d, %d, %d",
    (int) (color.getRed() * 255),
    (int) (color.getGreen() * 255),
    (int) (color.getBlue() * 255));

fill.setStyle("-fx-fill: rgba(" + rgb + ", 0.15);");
line.setStyle("-fx-stroke: rgba(" + rgb + ", 1.0);");

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

@Override
  public void applyStyle(String style) {
    for (Node node : getChildren()) {
      if (node instanceof IApplicableStyle) {
        ((IApplicableStyle)node).applyStyle(style);
      } else {
        node.setStyle(style);
      }
    }
  }
}

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

@Override
public void applyStyle(String style) {
  for (Node node : getChildren()) {
    if (node instanceof IApplicableStyle) {
      ((IApplicableStyle)node).applyStyle(style);
    } else {
      node.setStyle(style);
    }
  }
}

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

@Override
  public void applyStyle(String style) {
    for (Node node : getChildren()) {
      if (node instanceof IApplicableStyle) {
        ((IApplicableStyle)node).applyStyle(style);
      } else {
        node.setStyle(style);
      }
    }
  }
}

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

@Override
  public void applyStyle(String style) {
    for (Node node : getChildren()) {
      if (node instanceof IApplicableStyle) {
        ((IApplicableStyle)node).applyStyle(style);
      } else {
        node.setStyle(style);
      }
    }
  }
}

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

@Override
  public void applyStyle(String style) {
    for (Node node : getChildren()) {
      if (node instanceof IApplicableStyle) {
        ((IApplicableStyle)node).applyStyle(style);
      } else {
        node.setStyle(style);
      }
    }
  }
}

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

@Override
  public void applyStyle(String style) {
    for (Node node : getChildren()) {
      if (node instanceof IApplicableStyle) {
        ((IApplicableStyle)node).applyStyle(style);
      } else {
        node.setStyle(style);
      }
    }
  }
}

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

@Override
  public void applyStyle(String style) {
    for (Node node : getChildren()) {
      if (node instanceof IApplicableStyle) {
        ((IApplicableStyle)node).applyStyle(style);
      } else {
        node.setStyle(style);
      }
    }
  }
}

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

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

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

@Override
public void start(Stage primaryStage) {    
  SplitPane split = new SplitPane();
  ...
  Scene scene = new Scene(split);
  primaryStage.setScene(scene);
  primaryStage.show();

  Node divider = split.lookup(".split-pane-divider");
  if(divider!=null){
    divider.setStyle("-fx-background-color: transparent;");
  }
}

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

@Override public void handle(ActionEvent event) {
    alreadyFaded = false;
    alreadyHovered = false;
    wide = false;
    getSkinnable().setStyle(null);
    for (Node child : getChildren()) {
      child.setStyle(null);
    }
  }
});

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

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

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

private Node createDecorationNode(ValidationMessage message) {
  Node graphic = Severity.ERROR == message.getSeverity() ? createErrorNode() : createWarningNode();
  graphic.setStyle(SHADOW_EFFECT);
  Label label = new Label();
  label.setGraphic(graphic);
  label.setTooltip(createTooltip(message));
  label.setAlignment(Pos.CENTER);
  return label;
}

相关文章

微信公众号

最新文章

更多

Node类方法