javafx.scene.layout.BackgroundFill Java Examples
The following examples show how to use
javafx.scene.layout.BackgroundFill.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JFXTextAreaSkin.java From JFoenix with Apache License 2.0 | 6 votes |
@Override protected void layoutChildren(final double x, final double y, final double w, final double h) { super.layoutChildren(x, y, w, h); final double height = getSkinnable().getHeight(); linesWrapper.layoutLines(x, y, w, h, height, promptText == null ? 0 : promptText.getLayoutBounds().getHeight() + 3); errorContainer.layoutPane(x, height + linesWrapper.focusedLine.getHeight(), w, h); linesWrapper.updateLabelFloatLayout(); if (invalid) { invalid = false; // set the default background of text area viewport to white Region viewPort = (Region) scrollPane.getChildrenUnmodifiable().get(0); viewPort.setBackground(new Background(new BackgroundFill(Color.TRANSPARENT, CornerRadii.EMPTY, Insets.EMPTY))); // reapply css of scroll pane in case set by the user viewPort.applyCss(); errorContainer.invalid(w); // focus linesWrapper.invalid(); } }
Example #2
Source File: ClientDisplay.java From Open-Lowcode with Eclipse Public License 2.0 | 6 votes |
/** * @param message Displays a message in the status bar with normal status */ public void updateStatusBar(String message) { Date date = new Date(); String output = "" + sdf.format(date) + " " + message; logger.info(output); Platform.runLater(new Thread() { @Override public void run() { try { statuslabel.setBackground( new Background(new BackgroundFill(Color.WHITE, CornerRadii.EMPTY, Insets.EMPTY))); statuslabel.setText(output); } catch (Exception e) { logger.warning("Exception in setting status bar " + e.getMessage()); for (int i = 0; i < e.getStackTrace().length; i++) { String element = e.getStackTrace()[i].toString(); if (element.startsWith("org.openlowcode")) logger.warning(e.getStackTrace()[i].toString()); } } } }); }
Example #3
Source File: SunburstChart.java From charts with Apache License 2.0 | 6 votes |
private void initGraphics() { if (Double.compare(getPrefWidth(), 0.0) <= 0 || Double.compare(getPrefHeight(), 0.0) <= 0 || Double.compare(getWidth(), 0.0) <= 0 || Double.compare(getHeight(), 0.0) <= 0) { if (getPrefWidth() > 0 && getPrefHeight() > 0) { setPrefSize(getPrefWidth(), getPrefHeight()); } else { setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT); } } segmentPane = new Pane(); chartCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT); chartCanvas.setMouseTransparent(true); chartCtx = chartCanvas.getGraphicsContext2D(); pane = new Pane(segmentPane, chartCanvas); pane.setBackground(new Background(new BackgroundFill(backgroundPaint, CornerRadii.EMPTY, Insets.EMPTY))); pane.setBorder(new Border(new BorderStroke(borderPaint, BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(borderWidth)))); getChildren().setAll(pane); prepareData(); }
Example #4
Source File: TextClockSkin.java From Medusa with Apache License 2.0 | 6 votes |
@Override protected void initGraphics() { // Set initial size if (Double.compare(clock.getPrefWidth(), 0.0) <= 0 || Double.compare(clock.getPrefHeight(), 0.0) <= 0 || Double.compare(clock.getWidth(), 0.0) <= 0 || Double.compare(clock.getHeight(), 0.0) <= 0) { if (clock.getPrefWidth() > 0 && clock.getPrefHeight() > 0) { clock.setPrefSize(clock.getPrefWidth(), clock.getPrefHeight()); } else { clock.setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT); } } timeText = new Text(); timeText.setTextOrigin(VPos.CENTER); timeText.setFill(textColor); dateText = new Text(); dateText.setTextOrigin(VPos.CENTER); dateText.setFill(dateColor); pane = new Pane(timeText, dateText); pane.setBorder(new Border(new BorderStroke(clock.getBorderPaint(), BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(clock.getBorderWidth())))); pane.setBackground(new Background(new BackgroundFill(clock.getBackgroundPaint(), CornerRadii.EMPTY, Insets.EMPTY))); getChildren().setAll(pane); }
Example #5
Source File: TemplateGaugeSkin.java From medusademo with Apache License 2.0 | 6 votes |
private void initGraphics() { // Set initial size if (Double.compare(getSkinnable().getPrefWidth(), 0.0) <= 0 || Double.compare(getSkinnable().getPrefHeight(), 0.0) <= 0 || Double.compare(getSkinnable().getWidth(), 0.0) <= 0 || Double.compare(getSkinnable().getHeight(), 0.0) <= 0) { if (getSkinnable().getPrefWidth() > 0 && getSkinnable().getPrefHeight() > 0) { getSkinnable().setPrefSize(getSkinnable().getPrefWidth(), getSkinnable().getPrefHeight()); } else { getSkinnable().setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT); } } pane = new Pane(); pane.setBorder(new Border(new BorderStroke(getSkinnable().getBorderPaint(), BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(1)))); pane.setBackground(new Background(new BackgroundFill(getSkinnable().getBackgroundPaint(), CornerRadii.EMPTY, Insets.EMPTY))); getChildren().setAll(pane); }
Example #6
Source File: ClientDisplay.java From Open-Lowcode with Eclipse Public License 2.0 | 6 votes |
/** * @return a display with no page shown */ public Node getEmptyDisplay() { logger.severe("Setting empty display"); BorderPane mainpane = new BorderPane(); mainpane.setBackground(new Background(new BackgroundFill(Color.WHITE, null, null))); connectionbar = new ConnectionBar(this, urltoconnectto, this.questionmarkicon); this.userinteractionwidgets.add(connectionbar); Pane connectionpanel = connectionbar.getPane(); mainpane.setTop(connectionpanel); BorderPane.setMargin(connectionpanel, new Insets(3, 5, 3, 5)); Pane statusbar = generateStatusBar(); mainpane.setBottom(statusbar); BorderPane.setMargin(statusbar, new Insets(3, 5, 3, 5)); ScrollPane contentholder = new ScrollPane(); contentholder.setStyle("-fx-background: rgb(255,255,255);"); contentholder.setBorder(Border.EMPTY); mainpane.setCenter(contentholder); this.contentholder = contentholder; return mainpane; }
Example #7
Source File: RadarChart.java From tilesfx with Apache License 2.0 | 6 votes |
private void resize() { double width = getWidth() - getInsets().getLeft() - getInsets().getRight(); double height = getHeight() - getInsets().getTop() - getInsets().getBottom(); size = width < height ? width : height; if (size > 0) { pane.setMaxSize(size, size); pane.relocate((getWidth() - size) * 0.5, (getHeight() - size) * 0.5); pane.setBackground(new Background(new BackgroundFill(getChartBackgroundColor(), new CornerRadii(1024), Insets.EMPTY))); chartCanvas.setWidth(size); chartCanvas.setHeight(size); overlayCanvas.setWidth(size); overlayCanvas.setHeight(size); redraw(); } }
Example #8
Source File: SunburstChart.java From tilesfx with Apache License 2.0 | 6 votes |
private void initGraphics() { if (Double.compare(getPrefWidth(), 0.0) <= 0 || Double.compare(getPrefHeight(), 0.0) <= 0 || Double.compare(getWidth(), 0.0) <= 0 || Double.compare(getHeight(), 0.0) <= 0) { if (getPrefWidth() > 0 && getPrefHeight() > 0) { setPrefSize(getPrefWidth(), getPrefHeight()); } else { setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT); } } segmentPane = new Pane(); chartCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT); chartCanvas.setMouseTransparent(true); chartCtx = chartCanvas.getGraphicsContext2D(); pane = new Pane(segmentPane, chartCanvas); pane.setBackground(new Background(new BackgroundFill(backgroundPaint, CornerRadii.EMPTY, Insets.EMPTY))); pane.setBorder(new Border(new BorderStroke(borderPaint, BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(borderWidth)))); getChildren().setAll(pane); prepareData(); }
Example #9
Source File: MultiGaugeDemo.java From medusademo with Apache License 2.0 | 6 votes |
@Override public void start(Stage stage) { StackPane pane = new StackPane(gauge); pane.setPadding(new Insets(20)); pane.setBackground(new Background(new BackgroundFill(Gauge.DARK_COLOR, CornerRadii.EMPTY, Insets.EMPTY))); Scene scene = new Scene(pane); stage.setTitle("Medusa MultiGauge"); stage.setScene(scene); stage.show(); timer.start(); // Calculate number of nodes calcNoOfNodes(pane); System.out.println(noOfNodes + " Nodes in SceneGraph"); }
Example #10
Source File: ChargeSkin.java From Medusa with Apache License 2.0 | 6 votes |
private void initGraphics() { // Set initial size if (Double.compare(gauge.getPrefWidth(), 0.0) <= 0 || Double.compare(gauge.getPrefHeight(), 0.0) <= 0 || Double.compare(gauge.getWidth(), 0.0) <= 0 || Double.compare(gauge.getHeight(), 0.0) <= 0) { if (gauge.getPrefWidth() > 0 && gauge.getPrefHeight() > 0) { gauge.setPrefSize(gauge.getPrefWidth(), gauge.getPrefHeight()); } else { gauge.setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT); } } for (int i = 0 ; i < 12 ; i++) { Region bar = new Region(); bar.setPrefSize(20, 20 + (i * 4)); bars[i] = bar; } pane = new HBox(bars); pane.setSpacing(PREFERRED_WIDTH * 0.01960784); pane.setAlignment(Pos.BOTTOM_CENTER); pane.setFillHeight(false); pane.setBackground(new Background(new BackgroundFill(backgroundPaint, new CornerRadii(1024), Insets.EMPTY))); pane.setBorder(new Border(new BorderStroke(borderPaint, BorderStrokeStyle.SOLID, new CornerRadii(1024), new BorderWidths(borderWidth)))); getChildren().setAll(pane); }
Example #11
Source File: TileSkin.java From OEE-Designer with MIT License | 6 votes |
protected void initGraphics() { // Set initial size if (Double.compare(tile.getPrefWidth(), 0.0) <= 0 || Double.compare(tile.getPrefHeight(), 0.0) <= 0 || Double.compare(tile.getWidth(), 0.0) <= 0 || Double.compare(tile.getHeight(), 0.0) <= 0) { if (tile.getPrefWidth() > 0 && tile.getPrefHeight() > 0) { tile.setPrefSize(tile.getPrefWidth(), tile.getPrefHeight()); } else { tile.setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT); } } shadow = new DropShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.65), 3, 0, 0, 0); notifyRegion = new NotifyRegion(); enableNode(notifyRegion, false); pane = new Pane(notifyRegion); pane.setBorder(new Border(new BorderStroke(tile.getBorderColor(), BorderStrokeStyle.SOLID, new CornerRadii(PREFERRED_WIDTH * 0.025), new BorderWidths(tile.getBorderWidth())))); pane.setBackground(new Background(new BackgroundFill(tile.getBackgroundColor(), new CornerRadii(PREFERRED_WIDTH * 0.025), Insets.EMPTY))); getChildren().setAll(pane); }
Example #12
Source File: JFXTextAreaSkinAndroid.java From JFoenix with Apache License 2.0 | 6 votes |
@Override protected void layoutChildren(final double x, final double y, final double w, final double h) { super.layoutChildren(x, y, w, h); final double height = getSkinnable().getHeight(); linesWrapper.layoutLines(x, y, w, h, height, promptText == null ? 0 : promptText.getLayoutBounds().getHeight() + 3); errorContainer.layoutPane(x, height + linesWrapper.focusedLine.getHeight(), w, h); linesWrapper.updateLabelFloatLayout(); if (invalid) { invalid = false; // set the default background of text area viewport to white Region viewPort = (Region) scrollPane.getChildrenUnmodifiable().get(0); viewPort.setBackground(new Background(new BackgroundFill(Color.TRANSPARENT, CornerRadii.EMPTY, Insets.EMPTY))); // reapply css of scroll pane in case set by the user viewPort.applyCss(); errorContainer.invalid(w); // focus linesWrapper.invalid(); } }
Example #13
Source File: DigitalClockSkin.java From Medusa with Apache License 2.0 | 6 votes |
@Override protected void initGraphics() { // Set initial size if (Double.compare(clock.getPrefWidth(), 0.0) <= 0 || Double.compare(clock.getPrefHeight(), 0.0) <= 0 || Double.compare(clock.getWidth(), 0.0) <= 0 || Double.compare(clock.getHeight(), 0.0) <= 0) { if (clock.getPrefWidth() > 0 && clock.getPrefHeight() > 0) { clock.setPrefSize(clock.getPrefWidth(), clock.getPrefHeight()); } else { clock.setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT); } } canvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT); ctx = canvas.getGraphicsContext2D(); pane = new Pane(canvas); pane.setBorder(new Border(new BorderStroke(clock.getBorderPaint(), BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(clock.getBorderWidth())))); pane.setBackground(new Background(new BackgroundFill(clock.getBackgroundPaint(), CornerRadii.EMPTY, Insets.EMPTY))); getChildren().setAll(pane); }
Example #14
Source File: TileSparklineSkin.java From Medusa with Apache License 2.0 | 6 votes |
@Override protected void redraw() { pane.setBorder(new Border(new BorderStroke(gauge.getBorderPaint(), BorderStrokeStyle.SOLID, new CornerRadii(size * 0.025), new BorderWidths(gauge.getBorderWidth() / PREFERRED_WIDTH * size)))); pane.setBackground(new Background(new BackgroundFill(gauge.getBackgroundPaint(), new CornerRadii(size * 0.025), Insets.EMPTY))); locale = gauge.getLocale(); formatString = new StringBuilder("%.").append(Integer.toString(gauge.getDecimals())).append("f").toString(); titleText.setText(gauge.getTitle()); subTitleText.setText(gauge.getSubTitle()); resizeStaticText(); titleText.setFill(gauge.getTitleColor()); valueText.setFill(gauge.getValueColor()); averageText.setFill(gauge.getAverageColor()); highText.setFill(gauge.getValueColor()); lowText.setFill(gauge.getValueColor()); subTitleText.setFill(gauge.getSubTitleColor()); sparkLine.setStroke(gauge.getBarColor()); stdDeviationArea.setFill(Helper.getTranslucentColorFrom(gauge.getAverageColor(), 0.1)); averageLine.setStroke(gauge.getAverageColor()); dot.setFill(gauge.getBarColor()); }
Example #15
Source File: SlimClockSkin.java From Medusa with Apache License 2.0 | 6 votes |
@Override protected void redraw() { pane.setBorder(new Border(new BorderStroke(clock.getBorderPaint(), BorderStrokeStyle.SOLID, new CornerRadii(1024), new BorderWidths(clock.getBorderWidth() / 250 * size)))); pane.setBackground(new Background(new BackgroundFill(clock.getBackgroundPaint(), new CornerRadii(1024), Insets.EMPTY))); secondBackgroundCircle.setStroke(Helper.getTranslucentColorFrom(clock.getSecondColor(), 0.2)); secondArc.setStroke(clock.getSecondColor()); hour.setFill(clock.getHourColor()); minute.setFill(clock.getMinuteColor()); dateText.setFill(clock.getDateColor()); dateNumbers.setFill(clock.getDateColor()); hour.setFill(clock.getHourColor()); minute.setFill(clock.getMinuteColor()); ZonedDateTime time = clock.getTime(); updateTime(time); }
Example #16
Source File: LevelSkin.java From Medusa with Apache License 2.0 | 6 votes |
@Override protected void redraw() { locale = gauge.getLocale(); formatString = new StringBuilder("%.").append(Integer.toString(gauge.getDecimals())).append("f%%").toString(); // Background stroke and fill pane.setBorder(new Border(new BorderStroke(gauge.getBorderPaint(), BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(gauge.getBorderWidth() / PREFERRED_WIDTH * width)))); pane.setBackground(new Background(new BackgroundFill(gauge.getBackgroundPaint(), CornerRadii.EMPTY, Insets.EMPTY))); fluidBody.setFill(gauge.getBarColor()); fluidTop.setFill(gauge.getBarColor().darker()); valueText.setFill(gauge.getValueColor()); titleText.setFill(gauge.getTitleColor()); resizeText(); setBar(gauge.getCurrentValue()); }
Example #17
Source File: LogLine.java From LogFX with GNU General Public License v3.0 | 6 votes |
BackgroundTransition( Color targetColor ) { List<BackgroundFill> fills = getBackground().getFills(); if ( !fills.isEmpty() && fills.get( 0 ).getFill() instanceof Color ) { this.originalColor = ( Color ) fills.get( 0 ).getFill(); } else { this.originalColor = targetColor.invert(); } if ( targetColor.equals( originalColor ) ) { this.targetColor = targetColor.invert(); } else { this.targetColor = targetColor; } setCycleDuration( Duration.millis( 650 ) ); setInterpolator( Interpolator.EASE_OUT ); setCycleCount( 6 ); setAutoReverse( true ); setOnFinished( event -> setBackground( FxUtils.simpleBackground( originalColor ) ) ); }
Example #18
Source File: InfoPopup.java From charts with Apache License 2.0 | 5 votes |
public ObjectProperty<Color> backgroundColorProperty() { if (null == backgroundColor) { backgroundColor = new ObjectPropertyBase<Color>(_backgroundColor) { @Override protected void invalidated() { hBox.setBackground(new Background(new BackgroundFill(get(), new CornerRadii(3), Insets.EMPTY))); } @Override public Object getBean() { return InfoPopup.this; } @Override public String getName() { return "backgroundColor"; } }; _backgroundColor = null; } return backgroundColor; }
Example #19
Source File: SunburstChart.java From tilesfx with Apache License 2.0 | 5 votes |
public void redraw() { pane.setBackground(new Background(new BackgroundFill(backgroundPaint, CornerRadii.EMPTY, Insets.EMPTY))); pane.setBorder(new Border(new BorderStroke(borderPaint, BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(borderWidth / PREFERRED_WIDTH * size)))); segmentPane.setBackground(new Background(new BackgroundFill(getBackgroundColor(), CornerRadii.EMPTY, Insets.EMPTY))); segmentPane.setManaged(isInteractive()); segmentPane.setVisible(isInteractive()); drawChart(); }
Example #20
Source File: AlarmUI.java From phoebus with Eclipse Public License 1.0 | 5 votes |
/** @return Label that indicates missing server connection */ public static Label createNoServerLabel() { final Label no_server = new Label("No Alarm Server Connection"); no_server.setTextFill(Color.WHITE); no_server.setBackground(new Background(new BackgroundFill(Color.RED, CornerRadii.EMPTY, Insets.EMPTY))); return no_server; }
Example #21
Source File: JFXCheckBoxSkin.java From JFoenix with Apache License 2.0 | 5 votes |
private void playSelectAnimation(Boolean selection, boolean playAnimation) { if (selection == null) { selection = false; } transition.setRate(selection ? 1 : -1); select.setRate(selection ? 1 : -1); if (playAnimation) { transition.play(); select.play(); } else { CornerRadii radii = box.getBackground() == null ? null : box.getBackground().getFills().get(0).getRadii(); Insets insets = box.getBackground() == null ? null : box.getBackground().getFills().get(0).getInsets(); if (selection) { mark.setScaleY(1); mark.setScaleX(1); mark.setOpacity(1); box.setBackground(new Background(new BackgroundFill(getSkinnable().getCheckedColor(), radii, insets))); select.playFrom(select.getCycleDuration()); transition.playFrom(transition.getCycleDuration()); } else { mark.setScaleY(0); mark.setScaleX(0); mark.setOpacity(0); box.setBackground(new Background(new BackgroundFill(Color.TRANSPARENT, radii, insets))); select.playFrom(Duration.ZERO); transition.playFrom(Duration.ZERO); } } box.setBorder(new Border(new BorderStroke(selection ? getSkinnable().getCheckedColor() : getSkinnable().getUnCheckedColor(), BorderStrokeStyle.SOLID, new CornerRadii(2), new BorderWidths(2)))); }
Example #22
Source File: FontData.java From CPUSim with GNU General Public License v3.0 | 5 votes |
public void setFontAndBackground(StyledTextArea region) { region.setBackground(new Background(new BackgroundFill(Color.web( background), null, null))); String optQuote = font.contains(" ") ? "\"" : ""; region.setStyle("-fx-font-size:" + fontSize + "; " + "-fx-font-family:" + optQuote + font + optQuote + ";" + "-fx-highlight-fill:" + selection + ";"); }
Example #23
Source File: FuelGauge.java From medusademo with Apache License 2.0 | 5 votes |
@Override public void init() { fuelIcon = new Region(); fuelIcon.getStyleClass().setAll("fuel-icon"); gauge = GaugeBuilder.create() .skinType(SkinType.HORIZONTAL) .prefSize(500, 250) .knobColor(Color.rgb(0, 0, 0)) .foregroundBaseColor(Color.rgb(249, 249, 249)) .animated(true) .shadowsEnabled(true) .valueVisible(false) //.title("FUEL") .needleColor(Color.web("0xEF2F06")) //.needleColor(Color.rgb(255, 10, 1)) .needleShape(NeedleShape.ROUND) .needleSize(NeedleSize.THICK) .minorTickMarksVisible(false) .mediumTickMarksVisible(false) //.majorTickMarkType(TickMarkType.TRIANGLE) .sectionsVisible(true) .sections(new Section(0, 0.2, Color.rgb(255, 10, 1))) .minValue(0) .maxValue(1) .angleRange(90) .customTickLabelsEnabled(true) .customTickLabels("E", "", "", "", "", "1/2", "", "", "", "", "F") .build(); pane = new StackPane(fuelIcon, gauge); pane.setPadding(new Insets(10)); LinearGradient gradient = new LinearGradient(0, 0, 0, pane.getLayoutBounds().getHeight(), false, CycleMethod.NO_CYCLE, new Stop(0.0, Color.rgb(38, 38, 38)), new Stop(1.0, Color.rgb(15, 15, 15))); pane.setBackground(new Background(new BackgroundFill(gradient, CornerRadii.EMPTY, Insets.EMPTY))); }
Example #24
Source File: AddonFileMinimalView.java From CMPDL with MIT License | 5 votes |
@Override protected void updateItem(AddonFile item, boolean empty) { super.updateItem(item, empty); if (empty) { setGraphic(null); } else { fileName.setText(item.getDisplayName()); gameVersion.setText("for MC " + String.join(", ", item.getGameVersion())); fileType.setText(item.getReleaseType().toString()); fileType.setBackground(new Background(new BackgroundFill(item.getReleaseType().getColor(), new CornerRadii(5), new Insets(-2, -5, -2, -5)))); fileType.setTextFill(Color.WHITE); setGraphic(root); } }
Example #25
Source File: LeaderBoardItem.java From tilesfx with Apache License 2.0 | 5 votes |
private void initGraphics() { if (Double.compare(getPrefWidth(), 0.0) <= 0 || Double.compare(getPrefHeight(), 0.0) <= 0 || Double.compare(getWidth(), 0.0) <= 0 || Double.compare(getHeight(), 0.0) <= 0) { if (getPrefWidth() > 0 && getPrefHeight() > 0) { setPrefSize(getPrefWidth(), getPrefHeight()); } else { setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT); // 11x7 } } state = State.CONSTANT; triangle = new Path(); triangle.setStroke(null); triangle.setFill(state.color); triangle.setRotate(state.angle); nameText = new Text(getName()); nameText.setTextOrigin(VPos.TOP); valueText = new Text(); valueText.setTextOrigin(VPos.TOP); updateValueText(); separator = new Line(); pane = new Pane(triangle, nameText, valueText, separator); pane.setBackground(new Background(new BackgroundFill(Color.TRANSPARENT, CornerRadii.EMPTY, Insets.EMPTY))); getChildren().setAll(pane); }
Example #26
Source File: TileKpiSkin.java From Medusa with Apache License 2.0 | 5 votes |
@Override protected void redraw() { pane.setBorder(new Border(new BorderStroke(gauge.getBorderPaint(), BorderStrokeStyle.SOLID, new CornerRadii(size * 0.025), new BorderWidths(gauge.getBorderWidth() / PREFERRED_WIDTH * size)))); pane.setBackground(new Background(new BackgroundFill(gauge.getBackgroundPaint(), new CornerRadii(size * 0.025), Insets.EMPTY))); locale = gauge.getLocale(); formatString = new StringBuilder("%.").append(Integer.toString(gauge.getDecimals())).append("f").toString(); thresholdColor = gauge.getThresholdColor(); sectionsVisible = gauge.getSectionsVisible(); enableNode(sectionPane, sectionsVisible); titleText.setText(gauge.getTitle()); unitText.setText(gauge.getUnit()); minValueText.setText(String.format(locale, "%." + gauge.getTickLabelDecimals() + "f", gauge.getMinValue())); maxValueText.setText(String.format(locale, "%." + gauge.getTickLabelDecimals() + "f", gauge.getMaxValue())); thresholdText.setText(String.format(locale, "%." + gauge.getTickLabelDecimals() + "f", gauge.getThreshold())); resizeStaticText(); barBackground.setStroke(gauge.getBarColor()); thresholdBar.setStroke(gauge.getThresholdColor()); needleRect.setFill(gauge.getBackgroundPaint()); needle.setFill(gauge.getNeedleColor()); titleText.setFill(gauge.getTitleColor()); minValueText.setFill(gauge.getTitleColor()); maxValueText.setFill(gauge.getTitleColor()); thresholdRect.setFill(sectionsVisible ? Color.TRANSPARENT : gauge.getValue() > gauge.getThreshold() ? gauge.getThresholdColor() : GRAY); thresholdText.setFill(sectionsVisible ? Color.TRANSPARENT : gauge.getBackgroundPaint()); valueText.setFill(gauge.getValueColor()); highlightSections(gauge.getValue()); }
Example #27
Source File: ImagePane.java From paintera with GNU General Public License v2.0 | 5 votes |
/** * @param width * preferred component width. * @param height * preferred component height. */ public ImagePane( final int width, final int height) { super(); super.getChildren().add(imageView); this.setBackground(new Background(new BackgroundFill(Color.BLACK, CornerRadii.EMPTY, Insets.EMPTY))); setWidth(width); setHeight(height); // super.getChildren().setAll(this.imageView); }
Example #28
Source File: ScaleBarSample.java From arcgis-runtime-samples-java with Apache License 2.0 | 5 votes |
@Override public void start(Stage stage) { // create stack pane and application scene StackPane stackPane = new StackPane(); Scene scene = new Scene(stackPane); // set title, size and scene to stage stage.setTitle("Scale Bar Sample"); stage.setWidth(800); stage.setHeight(700); stage.setScene(scene); stage.show(); // create a map view mapView = new MapView(); ArcGISMap map = new ArcGISMap(Basemap.Type.IMAGERY, 64.1405, -16.2426, 16); mapView.setMap(map); // create a scale bar for the map view Scalebar scaleBar = new Scalebar(mapView); // specify skin style for the scale bar scaleBar.setSkinStyle(Scalebar.SkinStyle.GRADUATED_LINE); // set the unit system (default is METRIC) scaleBar.setUnitSystem(UnitSystem.IMPERIAL); // to enhance visibility of the scale bar, by making background transparent Color transparentWhite = new Color(1, 1, 1, 0.7); scaleBar.setBackground(new Background(new BackgroundFill(transparentWhite, new CornerRadii(5), Insets.EMPTY))); // add the map view and scale bar to stack pane stackPane.getChildren().addAll(mapView, scaleBar); // set position of scale bar StackPane.setAlignment(scaleBar, Pos.BOTTOM_CENTER); // give padding to scale bar StackPane.setMargin(scaleBar, new Insets(0, 0, 50, 0)); }
Example #29
Source File: PercentageTileSkin.java From tilesfx with Apache License 2.0 | 5 votes |
@Override protected void redraw() { super.redraw(); titleText.setText(tile.getTitle()); unitText.setText(tile.getUnit()); description.setText(tile.getDescription()); description.setAlignment(tile.getDescriptionAlignment()); percentageText.setText(String.format(locale, "%." + tile.getDecimals() + "f", tile.getValue() / range * 100)); maxValueText.setText(String.format(locale, "%." + tile.getTickLabelDecimals() + "f", tile.getMaxValue())); maxValueUnitText.setText(tile.getUnit()); resizeStaticText(); barBackground.setBackground(new Background(new BackgroundFill(tile.getBarBackgroundColor().brighter().brighter(), new CornerRadii(0.0, 0.0, tile.getRoundedCorners() ? size * 0.025 : 0.0, tile.getRoundedCorners() ? size * 0.025 : 0.0, false), Insets.EMPTY))); barColor = tile.getBarColor(); if (sectionsVisible && !sections.isEmpty()) { setBarColor(tile.getValue()); } else { bar.setFill(barColor); } titleText.setFill(tile.getTitleColor()); unitText.setFill(tile.getUnitColor()); description.setTextFill(tile.getDescriptionColor()); maxValueText.setFill(tile.getBackgroundColor()); maxValueUnitText.setFill(tile.getBackgroundColor()); maxValueRect.setFill(Double.compare(tile.getCurrentValue(), maxValue) >= 0 ? barColor : tile.getThresholdColor()); valueText.setFill(tile.getValueColor()); unitText.setFill(tile.getUnitColor()); }
Example #30
Source File: SunburstChart.java From charts with Apache License 2.0 | 5 votes |
private void redraw() { pane.setBackground(new Background(new BackgroundFill(backgroundPaint, CornerRadii.EMPTY, Insets.EMPTY))); pane.setBorder(new Border(new BorderStroke(borderPaint, BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(borderWidth / PREFERRED_WIDTH * size)))); segmentPane.setBackground(new Background(new BackgroundFill(getBackgroundColor(), CornerRadii.EMPTY, Insets.EMPTY))); segmentPane.setManaged(isInteractive()); segmentPane.setVisible(isInteractive()); drawChart(); }