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+";"); } }
datad.nodeProperty().addListener(new ChangeListener<Node>() { @Override public void changed(ObservableValue<? extends Node> ov, Node oldNode, Node newNode) { newNode.setStyle("-fx-bar-fill: red;"); } });
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;"); } } } });
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++; }
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)); } } }
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))); } } } });
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); } }
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);");
@Override public void applyStyle(String style) { for (Node node : getChildren()) { if (node instanceof IApplicableStyle) { ((IApplicableStyle)node).applyStyle(style); } else { node.setStyle(style); } } } }
@Override public void applyStyle(String style) { for (Node node : getChildren()) { if (node instanceof IApplicableStyle) { ((IApplicableStyle)node).applyStyle(style); } else { node.setStyle(style); } } }
@Override public void applyStyle(String style) { for (Node node : getChildren()) { if (node instanceof IApplicableStyle) { ((IApplicableStyle)node).applyStyle(style); } else { node.setStyle(style); } } } }
@Override public void applyStyle(String style) { for (Node node : getChildren()) { if (node instanceof IApplicableStyle) { ((IApplicableStyle)node).applyStyle(style); } else { node.setStyle(style); } } } }
@Override public void applyStyle(String style) { for (Node node : getChildren()) { if (node instanceof IApplicableStyle) { ((IApplicableStyle)node).applyStyle(style); } else { node.setStyle(style); } } } }
@Override public void applyStyle(String style) { for (Node node : getChildren()) { if (node instanceof IApplicableStyle) { ((IApplicableStyle)node).applyStyle(style); } else { node.setStyle(style); } } } }
@Override public void applyStyle(String style) { for (Node node : getChildren()) { if (node instanceof IApplicableStyle) { ((IApplicableStyle)node).applyStyle(style); } else { node.setStyle(style); } } } }
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; }
@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;"); } }
@Override public void handle(ActionEvent event) { alreadyFaded = false; alreadyHovered = false; wide = false; getSkinnable().setStyle(null); for (Node child : getChildren()) { child.setStyle(null); } } });
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+";"); } }
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; }