javafx.scene.layout.CornerRadii Java Examples

The following examples show how to use javafx.scene.layout.CornerRadii. 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: CustomGaugeSkinDemo.java    From medusademo with Apache License 2.0 7 votes vote down vote up
@Override public void start(Stage stage) {
    HBox pane = new HBox(gauge0, gauge1, gauge2, gauge3, gauge4, gauge5, gauge6, gauge7, gauge8, gauge9);
    pane.setBackground(new Background(new BackgroundFill(Gauge.DARK_COLOR, CornerRadii.EMPTY, Insets.EMPTY)));
    pane.setPadding(new Insets(10));
    pane.setPrefWidth(400);

    Scene scene = new Scene(pane);

    stage.setTitle("Medusa Custom Gauge Skin");
    stage.setScene(scene);
    stage.show();

    timer.start();

    // Calculate number of nodes
    calcNoOfNodes(pane);
    System.out.println(noOfNodes + " Nodes in SceneGraph");
}
 
Example #2
Source File: SlimSkin.java    From Medusa with Apache License 2.0 6 votes vote down vote up
@Override protected void redraw() {
    pane.setBorder(new Border(new BorderStroke(gauge.getBorderPaint(), BorderStrokeStyle.SOLID, new CornerRadii(1024), new BorderWidths(gauge.getBorderWidth() / PREFERRED_WIDTH * size))));
    pane.setBackground(new Background(new BackgroundFill(gauge.getBackgroundPaint(), new CornerRadii(1024), Insets.EMPTY)));
    colorGradientEnabled = gauge.isGradientBarEnabled();
    noOfGradientStops    = gauge.getGradientBarStops().size();
    sectionsVisible      = gauge.getSectionsVisible();

    titleText.setText(gauge.getTitle());
    unitText.setText(gauge.getUnit());
    resizeStaticText();

    barBackground.setStroke(gauge.getBarBackgroundColor());
    setBarColor(gauge.getCurrentValue());
    titleText.setFill(gauge.getTitleColor());
    valueText.setFill(gauge.getValueColor());
    unitText.setFill(gauge.getUnitColor());
}
 
Example #3
Source File: FlatSkin.java    From Medusa with Apache License 2.0 6 votes vote down vote up
@Override protected void redraw() {
    colorGradientEnabled = gauge.isGradientBarEnabled();
    noOfGradientStops    = gauge.getGradientBarStops().size();
    sectionsVisible      = gauge.getSectionsVisible();

    pane.setBackground(new Background(new BackgroundFill(gauge.getBackgroundPaint(), new CornerRadii(1024), Insets.EMPTY)));
    pane.setBorder(new Border(new BorderStroke(gauge.getBorderPaint(), BorderStrokeStyle.SOLID, new CornerRadii(1024), new BorderWidths(gauge.getBorderWidth() / PREFERRED_WIDTH * size))));

    setBarColor(gauge.getCurrentValue());
    valueText.setFill(gauge.getValueColor());
    unitText.setFill(gauge.getUnitColor());
    titleText.setFill(gauge.getTitleColor());
    separator.setStroke(gauge.getBorderPaint());

    titleText.setText(gauge.getTitle());
    resizeTitleText();

    unitText.setText(gauge.getUnit());
    resizeUnitText();
}
 
Example #4
Source File: JFXTextAreaSkin.java    From JFoenix with Apache License 2.0 6 votes vote down vote up
@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 #5
Source File: RoundLcdClockSkin.java    From Medusa with Apache License 2.0 6 votes vote down vote up
@Override protected void redraw() {
    pane.setBorder(new Border(new BorderStroke(clock.getBorderPaint(), BorderStrokeStyle.SOLID, new CornerRadii(1024), new BorderWidths(clock.getBorderWidth() / PREFERRED_WIDTH * size))));
    pane.setBackground(new Background(new BackgroundFill(clock.getBackgroundPaint(), new CornerRadii(1024), Insets.EMPTY)));
    ZonedDateTime time = clock.getTime();

    hourColor       = clock.getHourColor();
    minuteColor     = clock.getMinuteColor();
    fiveMinuteColor = minuteColor.darker();
    secondColor     = clock.getSecondColor();
    titleColor      = clock.getTitleColor();
    textColor       = clock.getTextColor();
    dateColor       = clock.getDateColor();
    alarmColor      = clock.getAlarmColor();

    drawBackground();
    drawForeground(time);
    drawHours(time);
    drawMinutes(time);
    drawSeconds(time);
}
 
Example #6
Source File: Test.java    From medusademo with Apache License 2.0 6 votes vote down vote up
@Override public void start(Stage stage) {
    StackPane pane = new StackPane(gauge);
    pane.setPadding(new Insets(10));
    pane.setBackground(new Background(new BackgroundFill(Color.rgb(50, 50, 50), CornerRadii.EMPTY, Insets.EMPTY)));

    Scene scene = new Scene(pane);

    stage.setTitle("Test");
    stage.setScene(scene);
    stage.show();

    // Calculate number of nodes
    calcNoOfNodes(pane);
    System.out.println(noOfNodes + " Nodes in SceneGraph");

}
 
Example #7
Source File: SlimClockSkin.java    From Medusa with Apache License 2.0 6 votes vote down vote up
@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 #8
Source File: DashboardSkin.java    From Medusa with Apache License 2.0 6 votes vote down vote up
@Override protected void redraw() {
    pane.setBorder(new Border(new BorderStroke(gauge.getBorderPaint(), BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(gauge.getBorderWidth() / 250 * size))));
    pane.setBackground(new Background(new BackgroundFill(gauge.getBackgroundPaint(), CornerRadii.EMPTY, Insets.EMPTY)));

    colorGradientEnabled = gauge.isGradientBarEnabled();
    noOfGradientStops    = gauge.getGradientBarStops().size();
    sectionsVisible      = gauge.getSectionsVisible();

    barBackground.setFill(gauge.getBarBackgroundColor());
    barBackground.setEffect(gauge.isShadowsEnabled() ? innerShadow : null);

    setBarColor(gauge.getCurrentValue());

    dataBar.setEffect(gauge.isShadowsEnabled() ? innerShadow : null);

    threshold.setStroke(gauge.getThresholdColor());
    double thresholdInnerRadius = 0.3 * height;
    double thresholdOuterRadius = 0.675 * height;
    double thresholdAngle       = Helper.clamp(90.0, 270.0, (gauge.getThreshold() - minValue) * angleStep + 90.0);
    threshold.setStartX(centerX + thresholdInnerRadius * Math.sin(-Math.toRadians(thresholdAngle)));
    threshold.setStartY(centerX + thresholdInnerRadius * Math.cos(-Math.toRadians(thresholdAngle)));
    threshold.setEndX(centerX + thresholdOuterRadius * Math.sin(-Math.toRadians(thresholdAngle)));
    threshold.setEndY(centerX + thresholdOuterRadius * Math.cos(-Math.toRadians(thresholdAngle)));

    redrawText();
}
 
Example #9
Source File: DesignClockSkin.java    From Medusa with Apache License 2.0 6 votes vote down vote up
@Override protected void redraw() {
    pane.setBorder(new Border(new BorderStroke(clock.getBorderPaint(), BorderStrokeStyle.SOLID, new CornerRadii(1024), new BorderWidths(clock.getBorderWidth() / PREFERRED_WIDTH * size))));
    pane.setBackground(new Background(new BackgroundFill(clock.getBackgroundPaint(), new CornerRadii(1024), Insets.EMPTY)));

    shadowGroup.setEffect(clock.getShadowsEnabled() ? dropShadow : null);

    // Tick Marks
    tickCanvas.setCache(false);
    drawTicks();
    tickCanvas.setCache(true);
    tickCanvas.setCacheHint(CacheHint.QUALITY);

    needle.setStroke(clock.getHourColor());

    ZonedDateTime time = clock.getTime();

    updateTime(time);
}
 
Example #10
Source File: SunburstChart.java    From OEE-Designer with MIT License 6 votes vote down vote up
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 #11
Source File: OverlayPane.java    From paintera with GNU General Public License v2.0 6 votes vote down vote up
/**
 */
public OverlayPane()
{
	super();
	super.getChildren().add(canvasPane);
	setBackground(new Background(new BackgroundFill(Color.BLACK.deriveColor(0.0, 1.0, 1.0, 0.0), CornerRadii.EMPTY, Insets.EMPTY)));

	this.overlayRenderers = new CopyOnWriteArrayList<>();

	final ChangeListener<Number> sizeChangeListener = (observable, oldValue, newValue)
			-> {
		final double wd = widthProperty().get();
		final double hd = heightProperty().get();
		final int    w  = (int) wd;
		final int    h  = (int) hd;
		if (w <= 0 || h <= 0)
			return;
		overlayRenderers.forEach(or -> or.setCanvasSize(w, h));
		layout();
		drawOverlays();
	};

	widthProperty().addListener(sizeChangeListener);
	heightProperty().addListener(sizeChangeListener);

}
 
Example #12
Source File: ThermometerRepresentation.java    From phoebus with Eclipse Public License 1.0 6 votes vote down vote up
Thermo(Color color)
{
    setFill(color);

    fill.setArcHeight(6);
    fill.setArcWidth(6);
    fill.setManaged(false);
    border.setFill(new LinearGradient(.3, 0, .7, 0, true, CycleMethod.NO_CYCLE,
            new Stop(0, Color.LIGHTGRAY),
            new Stop(.3, Color.WHITESMOKE),
            new Stop(1, Color.LIGHTGRAY)));
    border.setStroke(Color.BLACK);
    arc.setLargeArcFlag(true);
    rightcorner.setY(0);

    getChildren().add(border);
    getChildren().add(fill);
    getChildren().add(ellipse);
    setBorder(new Border(
            new BorderStroke(Color.BLACK, BorderStrokeStyle.SOLID, CornerRadii.EMPTY, BorderWidths.DEFAULT)));
}
 
Example #13
Source File: RegionBaseRepresentation.java    From phoebus with Eclipse Public License 1.0 6 votes vote down vote up
/** Create alarm-based border
 *  @param severity AlarmSeverity
 *  @param corners CornerRadii
 *  @return Border
 */
private static Border createAlarmBorder(final AlarmSeverity severity, final CornerRadii corners)
{
    switch (severity)
    {
    case NONE:
        // No alarm -> no border
        return null;
    case MINOR:
        // Minor -> Simple border
        return new Border(new BorderStroke(alarm_colors[severity.ordinal()], solid, corners, normal));
    case MAJOR:
        // Major -> Double border
        return new Border(new BorderStroke(alarm_colors[severity.ordinal()], solid, corners, thin),
                          new BorderStroke(alarm_colors[severity.ordinal()], solid, corners, thin, new Insets(-2*thin.getTop())));
    case INVALID:
        // Invalid -> Border is cleverly interrupted just like the communication to the control system
        return new Border(new BorderStroke(alarm_colors[severity.ordinal()], dash_dotted, corners, normal));
    case UNDEFINED:
    default:
        // Disconnected -> Dotted
        return new Border(new BorderStroke(alarm_colors[severity.ordinal()], dotted, corners, wide));
    }
}
 
Example #14
Source File: CombinedGauges.java    From medusademo with Apache License 2.0 6 votes vote down vote up
@Override public void start(Stage stage) {
    Pane pane = new Pane(bigGauge, smallGauge);
    pane.setBackground(new Background(new BackgroundFill(Gauge.DARK_COLOR, CornerRadii.EMPTY, Insets.EMPTY)));
    bigGauge.relocate(0, 0);
    smallGauge.relocate(0, 230);

    Scene scene = new Scene(pane);

    stage.setScene(scene);
    stage.show();

    timer.start();

    // Calculate number of nodes
    calcNoOfNodes(pane);
    System.out.println(noOfNodes + " Nodes in SceneGraph");
}
 
Example #15
Source File: TextSymbolRepresentation.java    From phoebus with Eclipse Public License 1.0 6 votes vote down vote up
@Override
protected Label createJFXNode ( ) throws Exception {

    Label symbol = new Label();

    symbol.setAlignment(JFXUtil.computePos(model_widget.propHorizontalAlignment().getValue(), model_widget.propVerticalAlignment().getValue()));
    symbol.setBackground(model_widget.propTransparent().getValue()
        ? null
        : new Background(new BackgroundFill(JFXUtil.convert(model_widget.propBackgroundColor().getValue()), CornerRadii.EMPTY, Insets.EMPTY))
    );
    symbol.setFont(JFXUtil.convert(model_widget.propFont().getValue()));
    symbol.setTextFill(JFXUtil.convert(model_widget.propForegroundColor().getValue()));
    symbol.setText("\u263A");

    enabled = model_widget.propEnabled().getValue();

    Styles.update(symbol, Styles.NOT_ENABLED, !enabled);

    return symbol;

}
 
Example #16
Source File: TilesfxClock.java    From mars-sim with GNU General Public License v3.0 6 votes vote down vote up
@SuppressWarnings("restriction")
@Override public void start(Stage stage) {

       HBox pane = new HBox(20, days, hours, minutes, seconds);
       pane.setPadding(new Insets(10));
       pane.setBackground(new Background(new BackgroundFill(Color.web("#606060"), CornerRadii.EMPTY, Insets.EMPTY)));

       //Scene scene = new Scene(pane);

       PerspectiveCamera camera = new PerspectiveCamera();
       camera.setFieldOfView(7);

       Scene scene = new Scene(pane);
       scene.setCamera(camera);
       
       stage.setTitle("Countdown");
       stage.setScene(scene);
       stage.show();

       timer.start();
   }
 
Example #17
Source File: AlarmTreeView.java    From phoebus with Eclipse Public License 1.0 6 votes vote down vote up
/** @param model Model to represent. Must <u>not</u> be running, yet */
public AlarmTreeView(final AlarmClient model)
{
    if (model.isRunning())
        throw new IllegalStateException();

    changing.setTextFill(Color.WHITE);
    changing.setBackground(new Background(new BackgroundFill(Color.BLUE, CornerRadii.EMPTY, Insets.EMPTY)));

    this.model = model;

    tree_view.setShowRoot(false);
    tree_view.setCellFactory(view -> new AlarmTreeViewCell());
    tree_view.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);

    setTop(createToolbar());
    setCenter(tree_view);

    tree_view.setRoot(createViewItem(model.getRoot()));

    model.addListener(this);

    createContextMenu();
    addClickSupport();
    addDragSupport();
}
 
Example #18
Source File: AnnunciatorTable.java    From phoebus with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Set the color of the cell if muted is <code>true</code>.
 * @param muted - boolean
 */
protected void setMutedColor(final boolean muted)
{
    final int rowIndex = getTableRow().getIndex();
    // Determine the row specific color.
    final String rowColor       = rowIndex % 2 == 0 ? WHITE  : OFF_WHITE;
    final String mutedRowColor  = rowIndex % 2 == 0 ? ORANGE : OFF_ORANGE;

    // Color the cells if muted, leave them the row color otherwise.
    String color = (muted) ? mutedRowColor : rowColor;

    setBackground( new Background( new BackgroundFill(
                                    Paint.valueOf(color), // Set the color.
                                    new CornerRadii(0),   // We want square cells.
                                    new Insets(1))));     // Don't color over the cell borders.

    /*
     * Upon row selection, the table will update the text color based on the darkness of the ROW background.
     * Not the cell background. So the cell may have a white background, but the row could be blue when selected.
     * This blue color would trigger the table to set the cell's text color to white to provide a nice contrast.
     * Only the white text would be displayed on the cell's white background, not the blue background of the
     * table row. To prevent this, set the cell's text color to always be black when drawn on a background.
     */
    setStyle("-fx-text-background-color: black;");
}
 
Example #19
Source File: CustomGaugeSkin.java    From medusademo with Apache License 2.0 6 votes vote down vote up
private void initGraphics() {
    backgroundCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT);
    backgroundCtx    = backgroundCanvas.getGraphicsContext2D();

    foregroundCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT);
    foregroundCtx    = foregroundCanvas.getGraphicsContext2D();

    ledInnerShadow   = new InnerShadow(BlurType.TWO_PASS_BOX, Color.BLACK, 0.2 * PREFERRED_WIDTH, 0, 0, 0);
    ledDropShadow    = new DropShadow(BlurType.TWO_PASS_BOX, getSkinnable().getBarColor(), 0.3 * PREFERRED_WIDTH, 0, 0, 0);

    pane = new Pane(backgroundCanvas, foregroundCanvas);
    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 #20
Source File: ClientDisplay.java    From Open-Lowcode with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * displays a message in the status bar
 * 
 * @param message     the message to show
 * @param showaserror if true, message is shown as error (in yellow), if false,
 *                    displays it as simple text
 */
public void updateStatusBar(String message, boolean showaserror) {
	if (showaserror) {
		Platform.runLater(new Thread() {
			@Override
			public void run() {
				try {
					Date date = new Date();
					String output = "" + sdf.format(date) + " " + message;
					logger.info(output);
					statuslabel.setBackground(
							new Background(new BackgroundFill(Color.YELLOW, 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());
					}
				}
			}
		});
	} else
		updateStatusBar(message);
}
 
Example #21
Source File: RoundLcdClockSkin.java    From Medusa with Apache License 2.0 5 votes vote down vote up
@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);
        }
    }

    backgroundCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT);
    backgroundCtx = backgroundCanvas.getGraphicsContext2D();

    foregroundCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT);
    foregroundCtx = foregroundCanvas.getGraphicsContext2D();

    hoursCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT);
    hoursCtx = hoursCanvas.getGraphicsContext2D();

    minutesCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT);
    minutesCtx = minutesCanvas.getGraphicsContext2D();

    secondsCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT);
    secondsCtx = secondsCanvas.getGraphicsContext2D();

    pane = new Pane(backgroundCanvas, foregroundCanvas, hoursCanvas, minutesCanvas, secondsCanvas);
    pane.setBorder(new Border(new BorderStroke(clock.getBorderPaint(), BorderStrokeStyle.SOLID, new CornerRadii(1024), new BorderWidths(clock.getBorderWidth()))));
    pane.setBackground(new Background(new BackgroundFill(clock.getBackgroundPaint(), new CornerRadii(1024), Insets.EMPTY)));

    getChildren().setAll(pane);
}
 
Example #22
Source File: JFXColorPickerSkin.java    From JFoenix with Apache License 2.0 5 votes vote down vote up
private void initColor() {
    final ColorPicker colorPicker = (ColorPicker) getSkinnable();
    Color color = colorPicker.getValue();
    Color circleColor = color == null ? Color.WHITE : color;
    // update picker box color
    colorBox.setBackground(new Background(new BackgroundFill(circleColor, new CornerRadii(3), Insets.EMPTY)));
    // update label color
    displayNode.setTextFill(circleColor.grayscale().getRed() < 0.5 ? Color.valueOf(
        "rgba(255, 255, 255, 0.87)") : Color.valueOf("rgba(0, 0, 0, 0.87)"));
    if (colorLabelVisible.get()) {
        displayNode.setText(JFXNodeUtils.colorToHex(circleColor));
    } else {
        displayNode.setText("");
    }
}
 
Example #23
Source File: WhiteSkin.java    From Medusa with Apache License 2.0 5 votes vote down vote up
@Override protected void redraw() {
    pane.setBackground(new Background(new BackgroundFill(gauge.getBackgroundPaint(), new CornerRadii(1024), Insets.EMPTY)));
    pane.setBorder(new Border(new BorderStroke(gauge.getBorderPaint(), BorderStrokeStyle.SOLID, new CornerRadii(1024), new BorderWidths(gauge.getBorderWidth() / PREFERRED_WIDTH * size))));

    valueText.setFill(gauge.getValueColor());
    unitText.setFill(gauge.getUnitColor());

    unitText.setText(gauge.getUnit());
    resizeUnitText();
}
 
Example #24
Source File: AddonFileMinimalView.java    From CMPDL with MIT License 5 votes vote down vote up
@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: TilesFXSeries.java    From tilesfx with Apache License 2.0 5 votes vote down vote up
public TilesFXSeries(final Series<X, Y> SERIES, final Paint COLOR) {
    series = SERIES;
    stroke = COLOR;
    fill   = COLOR;
    if (null != COLOR) {
        symbolBackground = new Background(new BackgroundFill(COLOR, new CornerRadii(5), Insets.EMPTY), new BackgroundFill(Color.WHITE, new CornerRadii(5), new Insets(2)));
        legendSymbolFill = COLOR;
    }
}
 
Example #26
Source File: ParetoInfoPopup.java    From charts with Apache License 2.0 5 votes vote down vote up
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 ParetoInfoPopup.this; }
            @Override public String getName() { return "backgroundColor"; }
        };
        _backgroundColor = null;
    }
    return backgroundColor;
}
 
Example #27
Source File: SunburstChart.java    From OEE-Designer with MIT License 5 votes vote down vote up
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 #28
Source File: JFXCheckBoxSkin.java    From JFoenix with Apache License 2.0 5 votes vote down vote up
private void playIndeterminateAnimation(Boolean indeterminate, boolean playAnimation) {
    if (indeterminate == null) {
        indeterminate = false;
    }
    indeterminateTransition.setRate(indeterminate ? 1 : -1);
    if (playAnimation) {
        indeterminateTransition.play();
    } else {
        if (indeterminate) {
            CornerRadii radii = indeterminateMark.getBackground() == null ?
                null : indeterminateMark.getBackground().getFills().get(0).getRadii();
            Insets insets = indeterminateMark.getBackground() == null ?
                null : indeterminateMark.getBackground().getFills().get(0).getInsets();
            indeterminateMark.setOpacity(1);
            indeterminateMark.setScaleY(1);
            indeterminateMark.setScaleX(1);
            indeterminateMark.setBackground(new Background(new BackgroundFill(getSkinnable().getCheckedColor(), radii, insets)));
            indeterminateTransition.playFrom(indeterminateTransition.getCycleDuration());
        } else {
            indeterminateMark.setOpacity(0);
            indeterminateMark.setScaleY(0);
            indeterminateMark.setScaleX(0);
            indeterminateTransition.playFrom(Duration.ZERO);
        }
    }

    if (getSkinnable().isSelected()) {
        playSelectAnimation(!indeterminate, playAnimation);
    }
}
 
Example #29
Source File: Demo.java    From Enzo with Apache License 2.0 5 votes vote down vote up
@Override public void start(Stage stage) {
    VBox pane = new VBox();
    pane.setPadding(new Insets(10, 10, 10, 10));
    pane.setBackground(new Background(new BackgroundFill(Color.web("#34495e"), CornerRadii.EMPTY, Insets.EMPTY)));
    pane.setSpacing(20);
    pane.setAlignment(Pos.CENTER);
    pane.getChildren().addAll(onOffSwitch, iconSwitchSymbol, iconSwitchText, iconSwitchSymbol1);

    Scene scene = new Scene(pane, 100, 150);

    stage.setTitle("OnOffSwitch");
    stage.setScene(scene);
    stage.show();
}
 
Example #30
Source File: MinimalClockSkin.java    From Medusa with Apache License 2.0 5 votes vote down vote up
@Override protected void redraw() {
    pane.setBackground(new Background(new BackgroundFill(clock.getBackgroundPaint(), new CornerRadii(1024), new Insets(size * 0.035))));

    secondBackgroundCircle.setStroke(Helper.getTranslucentColorFrom(clock.getSecondColor(), 0.6));
    secondArc.setStroke(clock.getSecondColor());

    dateText.setFill(clock.getTextColor());
    hour.setFill(clock.getTextColor());
    minuteCircle.setFill(clock.getMinuteColor());
    minute.setFill(clock.getTextColor());

    ZonedDateTime time = clock.getTime();
    updateTime(time);
}