List of usage examples for javafx.scene Node setStyle
public final void setStyle(String value)
From source file:calendarioSeries.vistas.NewSerieController.java
private void changeStyleOnHover(Node node) { node.setOnMouseEntered(new EventHandler<MouseEvent>() { @Override//w w w . j av a 2 s .c o m public void handle(MouseEvent event) { node.setStyle("-fx-background-color: derive(#0096C9, 30%);"); } }); node.setOnMouseExited(new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent event) { node.setStyle("-fx-background-color: #0096C9"); } }); }
From source file:org.noroomattheinn.visibletesla.MainController.java
/** * Called by the main application to allow us to store away the fxApp context * and perform any other fxApp startup tasks. In particular, we (1) distribute * fxApp context to all of the controllers, and (2) we set a listener for login * completion and try and automatic login. *//*from ww w.j a v a 2 s . co m*/ void start(App theApp, VTVehicle v, VTData data, Prefs prefs) { this.app = theApp; this.vtVehicle = v; // This is defined in BaseController this.vtData = data; // This is defined in BaseController this.prefs = prefs; // This is defined in BaseController logAppInfo(); addSystemSpecificHandlers(app.stage); refreshTitle(); app.stage.getIcons().add(new Image(getClass().getClassLoader() .getResourceAsStream("org/noroomattheinn/TeslaResources/Icon-72@2x.png"))); tabPane.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<Tab>() { @Override public void changed(ObservableValue<? extends Tab> ov, Tab t, Tab t1) { BaseController c = controllerFromTab(t1); if (c != null) { c.activate(); } } }); tabs = Arrays.asList(prefsTab, loginTab, schedulerTab, graphTab, chargeTab, hvacTab, locationTab, overviewTab, tripsTab, notifierTab); for (Tab t : tabs) { controllerFromTab(t).setAppContext(theApp, v, data, prefs); } // Handle font scaling int fontScale = prefs.fontScale.get(); if (fontScale != 100) { for (Tab t : tabs) { Node n = t.getContent(); n.setStyle(String.format("-fx-font-size: %d%%;", fontScale)); } } showDisclaimer(); // Watch for changes to the inactivity mode and state in order to update the UI App.addTracker(app.api.mode, new Runnable() { @Override public void run() { setAppModeMenu(); } }); App.addTracker(app.api.state, new Runnable() { @Override public void run() { refreshTitle(); } }); // Kick off the login process LoginController lc = Utils.cast(controllerFromTab(loginTab)); App.addTracker(lc.loggedIn, new LoginStateChange(lc.loggedIn, false)); lc.activate(); }
From source file:com.chart.SwingChart.java
/** * Update background, tick and gridline colors * @param cfg cfg[0] Background, cfg[1] Chart background, cfg[2] y cfg[3] gridline *//*from w w w . j ava 2s.c o m*/ public void updateChartColors(String[] cfg) { strBackgroundColor = cfg[0]; for (Node le : legendFrame.getChildren()) { if (le instanceof LegendAxis) { le.setStyle("-fx-background-color:" + strBackgroundColor); ((LegendAxis) le).selected = false; } } chart.setBackgroundPaint(scene2awtColor(javafx.scene.paint.Color.web(strBackgroundColor))); chartPanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4), BorderFactory.createLineBorder(scene2awtColor(javafx.scene.paint.Color.web(strBackgroundColor))))); chartPanel.setBackground(scene2awtColor(javafx.scene.paint.Color.web(strBackgroundColor))); legendFrame.setStyle("marco: " + strBackgroundColor + ";-fx-background-color: marco;"); strChartBackgroundColor = cfg[1]; ; plot.setBackgroundPaint(scene2awtColor(javafx.scene.paint.Color.web(strChartBackgroundColor))); for (Node le : legendFrame.getChildren()) { if (le instanceof LegendAxis) { le.setStyle("-fx-background-color:" + strBackgroundColor); ((LegendAxis) le).selected = false; for (Node nn : ((LegendAxis) le).getChildren()) { if (nn instanceof Label) { ((Label) nn).setStyle("fondo: " + strChartBackgroundColor + ";-fx-background-color: fondo;-fx-text-fill: ladder(fondo, white 49%, black 50%);-fx-padding:5px;-fx-background-radius: 5;-fx-font-size: " + String.valueOf(fontSize) + "px"); } } } } strGridlineColor = cfg[2]; ; plot.setDomainGridlinePaint(scene2awtColor(javafx.scene.paint.Color.web(strGridlineColor))); plot.setRangeGridlinePaint(scene2awtColor(javafx.scene.paint.Color.web(strGridlineColor))); strTickColor = cfg[3]; ; abcissaAxis.setLabelPaint(scene2awtColor(javafx.scene.paint.Color.web(strTickColor))); abcissaAxis.setTickLabelPaint(scene2awtColor(javafx.scene.paint.Color.web(strTickColor))); for (NumberAxis ejeOrdenada : AxesList) { ejeOrdenada.setLabelPaint(scene2awtColor(javafx.scene.paint.Color.web(strTickColor))); ejeOrdenada.setTickLabelPaint(scene2awtColor(javafx.scene.paint.Color.web(strTickColor))); } }
From source file:com.chart.SwingChart.java
/** * Background edition/*from w ww .j a v a 2 s .com*/ */ final public void backgroundEdition() { final ColorPicker colorPickerChartBackground = new ColorPicker( javafx.scene.paint.Color.web(strChartBackgroundColor)); colorPickerChartBackground.setMaxWidth(Double.MAX_VALUE); final ColorPicker colorPickerGridline = new ColorPicker(javafx.scene.paint.Color.web(strGridlineColor)); colorPickerGridline.setMaxWidth(Double.MAX_VALUE); final ColorPicker colorPickerBackground = new ColorPicker(javafx.scene.paint.Color.web(strBackgroundColor)); colorPickerBackground.setMaxWidth(Double.MAX_VALUE); final ColorPicker colorPickerTick = new ColorPicker(javafx.scene.paint.Color.web(strTickColor)); colorPickerTick.setMaxWidth(Double.MAX_VALUE); final TextField tfFontSize = new TextField(); tfFontSize.setMaxWidth(Double.MAX_VALUE); GridPane grid = new GridPane(); grid.setHgap(10); grid.setVgap(10); grid.setPadding(new Insets(0, 10, 0, 10)); grid.add(new Label("Background color"), 0, 0); grid.add(colorPickerChartBackground, 1, 0); grid.add(new Label("Gridline color"), 0, 1); grid.add(colorPickerGridline, 1, 1); grid.add(new Label("Frame color"), 0, 2); grid.add(colorPickerBackground, 1, 2); grid.add(new Label("Tick color"), 0, 3); grid.add(colorPickerTick, 1, 3); grid.add(new Label("Font size"), 0, 4); grid.add(tfFontSize, 1, 4); tfFontSize.setText(String.valueOf(fontSize)); new PseudoModalDialog(skeleton, grid, true) { @Override public boolean validation() { fontSize = Float.valueOf(tfFontSize.getText().replace(",", ".")); strBackgroundColor = colorPickerBackground.getValue().toString().replace("0x", "#"); for (Node le : legendFrame.getChildren()) { if (le instanceof LegendAxis) { le.setStyle("-fx-background-color:" + strBackgroundColor); ((LegendAxis) le).selected = false; } } chart.setBackgroundPaint(scene2awtColor(javafx.scene.paint.Color.web(strBackgroundColor))); chartPanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4), BorderFactory.createLineBorder( scene2awtColor(javafx.scene.paint.Color.web(strBackgroundColor))))); chartPanel.setBackground(scene2awtColor(javafx.scene.paint.Color.web(strBackgroundColor))); legendFrame.setStyle("marco: " + colorPickerBackground.getValue().toString().replace("0x", "#") + ";-fx-background-color: marco;"); strChartBackgroundColor = colorPickerChartBackground.getValue().toString().replace("0x", "#"); plot.setBackgroundPaint(scene2awtColor(javafx.scene.paint.Color.web(strChartBackgroundColor))); for (Node le : legendFrame.getChildren()) { if (le instanceof LegendAxis) { le.setStyle("-fx-background-color:" + strBackgroundColor); ((LegendAxis) le).selected = false; for (Node nn : ((LegendAxis) le).getChildren()) { if (nn instanceof Label) { ((Label) nn).setStyle("fondo: " + colorPickerChartBackground.getValue().toString().replace("0x", "#") + ";-fx-background-color: fondo;-fx-text-fill: ladder(fondo, white 49%, black 50%);-fx-padding:5px;-fx-background-radius: 5;-fx-font-size: " + String.valueOf(fontSize) + "px"); } } } } strGridlineColor = colorPickerGridline.getValue().toString().replace("0x", "#"); plot.setDomainGridlinePaint(scene2awtColor(javafx.scene.paint.Color.web(strGridlineColor))); plot.setRangeGridlinePaint(scene2awtColor(javafx.scene.paint.Color.web(strGridlineColor))); strTickColor = colorPickerTick.getValue().toString().replace("0x", "#"); abcissaAxis.setLabelPaint(scene2awtColor(javafx.scene.paint.Color.web(strTickColor))); abcissaAxis.setTickLabelPaint(scene2awtColor(javafx.scene.paint.Color.web(strTickColor))); abcissaAxis.setLabelFont(abcissaAxis.getLabelFont().deriveFont(fontSize)); abcissaAxis.setTickLabelFont(abcissaAxis.getLabelFont().deriveFont(fontSize)); for (NumberAxis ejeOrdenada : AxesList) { ejeOrdenada.setLabelPaint(scene2awtColor(javafx.scene.paint.Color.web(strTickColor))); ejeOrdenada.setTickLabelPaint(scene2awtColor(javafx.scene.paint.Color.web(strTickColor))); ejeOrdenada.setLabelFont(ejeOrdenada.getLabelFont().deriveFont(fontSize)); ejeOrdenada.setTickLabelFont(ejeOrdenada.getLabelFont().deriveFont(fontSize)); } return true; } }.show(); }
From source file:com.chart.SwingChart.java
/** * /*from w ww . ja va 2 s .c o m*/ * @param axis Axis name to wich the new series belongs * @param cs Series Coinfiguration */ @Override public final void addSeries(String axis, SimpleSeriesConfiguration cs) { for (int i = 0; i < axes.size(); i++) { if (axes.get(i).getName().equals(axis)) { String strColor; javafx.scene.paint.Color color; int indice = seriesList.size(); if (cs.getColor() == null) { color = getColor(indice); } else { color = cs.getColor(); } strColor = color.toString(); XYSeriesCollection dataset = datasetList.get(i); Series series = new Series(cs.getName(), "color: " + strColor + ";width: " + String.valueOf(cs.getLineWidth()) + ";shape: " + cs.getShapeName() + ";", i, dataset.getSeriesCount()); dataset.addSeries(series); XYItemRenderer renderer = plot.getRenderer(i); renderer.setSeriesPaint(dataset.getSeriesCount() - 1, scene2awtColor(color)); SeriesShape simb = new SeriesShape(cs.getShapeName(), javafx.scene.paint.Color.web(strColor.replace("#", "0x"))); if (cs.getLineWidth() > 0) { ((XYLineAndShapeRenderer) renderer).setSeriesLinesVisible(dataset.getSeriesCount() - 1, true); renderer.setSeriesStroke(dataset.getSeriesCount() - 1, new BasicStroke(cs.getLineWidth())); } else { ((XYLineAndShapeRenderer) renderer).setSeriesLinesVisible(dataset.getSeriesCount() - 1, false); } if (cs.getShapeName().equals("null")) { renderer.setSeriesShape(dataset.getSeriesCount() - 1, null); ((XYLineAndShapeRenderer) renderer).setSeriesShapesVisible(dataset.getSeriesCount() - 1, false); } else { renderer.setSeriesShape(dataset.getSeriesCount() - 1, simb.getShapeAWT()); ((XYLineAndShapeRenderer) renderer).setSeriesShapesVisible(dataset.getSeriesCount() - 1, true); if (cs.getShapeName().contains("empty")) { ((XYLineAndShapeRenderer) renderer).setSeriesShapesFilled(dataset.getSeriesCount() - 1, false); } else { ((XYLineAndShapeRenderer) renderer).setSeriesShapesFilled(dataset.getSeriesCount() - 1, true); } } if (i == 0) { plot.setRenderer(renderer); } else { plot.setRenderer(i, renderer); } seriesList.add(series); final LegendAxis le = getLegendAxis(axis); final Label label = new Label(cs.toString()); Platform.runLater(() -> { label.setStyle("fondo: " + strChartBackgroundColor + ";-fx-background-color: fondo;-fx-text-fill: ladder(fondo, white 49%, black 50%);-fx-padding:5px;-fx-background-radius: 5;-fx-font-size: " + String.valueOf(fontSize) + "px"); }); label.setOnMouseClicked((MouseEvent t) -> { if (t.getClickCount() == 2) { for (int i1 = 0; i1 < seriesList.size(); i1++) { if (seriesList.get(i1).getKey().toString().equals(label.getText())) { editSeries(seriesList.get(i1)); break; } } } }); label.setOnMouseExited((MouseEvent t) -> { label.setStyle( label.getStyle().replace("-fx-background-color: blue", "-fx-background-color: fondo")); }); label.setOnMouseEntered((MouseEvent t) -> { label.setStyle( label.getStyle().replace("-fx-background-color: fondo", "-fx-background-color: blue")); for (Node le1 : legendFrame.getChildren()) { if (le1 instanceof LegendAxis) { le1.setStyle("-fx-background-color:" + strBackgroundColor); ((LegendAxis) le1).selected = false; } } }); label.setStyle("fondo: " + strChartBackgroundColor + ";-fx-text-fill: white;-fx-background-color: fondo;-fx-padding:5px;-fx-background-radius: 5;-fx-font-size: " + String.valueOf(fontSize) + "px"); le.getChildren().add(label); label.setGraphic(simb.getShapeGraphic()); break; } } }
From source file:de.bayern.gdi.gui.Controller.java
/** * Resets all marks at the processing chain container, items are kept. *//*from w w w. j a v a 2 s . co m*/ private void resetProcessingChainContainer() { for (Node o : chainContainer.getChildren()) { if (o instanceof VBox) { VBox v = (VBox) o; HBox hbox = (HBox) v.getChildren().get(0); Node cBox = hbox.getChildren().get(0); if (cBox instanceof ComboBox) { cBox.setStyle(FX_BORDER_COLOR_NULL); ComboBox box = (ComboBox) cBox; ObservableList<ProcessingStepConfiguration> confs = (ObservableList<ProcessingStepConfiguration>) box .getItems(); for (ProcessingStepConfiguration cfgI : confs) { cfgI.setCompatible(true); confs.set(confs.indexOf(cfgI), cfgI); } } } } }