Java Code Examples for javafx.scene.paint.CycleMethod

The following examples show how to use javafx.scene.paint.CycleMethod. These examples are extracted from open source projects. 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 want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: constellation   Source File: ConversationBubble.java    License: Apache License 2.0 6 votes vote down vote up
public final void setColor(final Color color) {
    Color bottomColor = color.darker();
    Color topColor = color.brighter();

    Stop[] stops = new Stop[]{
        new Stop(0, topColor),
        new Stop(1, bottomColor)
    };
    LinearGradient gradient = new LinearGradient(0, 0, 0, 1, true, CycleMethod.NO_CYCLE, stops);

    bubbleGraphic.setStroke(color);
    bubbleGraphic.setFill(gradient);

    tail.setFill(bottomColor);
    tail.setStroke(color);
    tailTop.setStroke(bottomColor); // Erase the border of the buble where the tail joins
}
 
Example 2
Source Project: constellation   Source File: ScatterChartPane.java    License: Apache License 2.0 6 votes vote down vote up
public ScatterChartPane(final ScatterPlotPane parent) {
    this.scatterPlot = parent;

    final LinearGradient gradient = new LinearGradient(0.0, 0.0, 0.0, 0.75, true, CycleMethod.NO_CYCLE,
            new Stop[]{new Stop(0, Color.LIGHTGRAY), new Stop(1, Color.GRAY.darker())});
    this.selection = new Rectangle(0, 0, 0, 0);
    selection.setFill(Color.WHITE);
    selection.setStroke(Color.BLACK);
    selection.setOpacity(0.4);
    selection.setMouseTransparent(true);
    selection.setStroke(Color.SILVER);
    selection.setStrokeWidth(2d);
    selection.setFill(gradient);
    selection.setSmooth(true);
    selection.setArcWidth(5.0);
    selection.setArcHeight(5.0);

    this.tooltip = new Tooltip();

    this.currentData = Collections.synchronizedSet(new HashSet<>());
    this.currentSelectedData = new HashSet<>();

    this.getChildren().addAll(selection);
    this.setId("scatter-chart-pane");
    this.setPadding(new Insets(5));
}
 
Example 3
Source Project: marathonv5   Source File: RadialGradientSample.java    License: Apache License 2.0 6 votes vote down vote up
public RadialGradientSample() {
    //create simple radial gradient
    RadialGradient gradient1 = new RadialGradient(0, 0, 0.5, 0.5, 1, true, CycleMethod.NO_CYCLE, new Stop[] {
        new Stop(0, Color.DODGERBLUE),
        new Stop(1, Color.BLACK)
    });
    Circle circle1 = new Circle(45, 45, 40, gradient1);

    //create complex radial gradient
    RadialGradient gradient2 = new RadialGradient(20, 1, 0.5, 0.5, 0.6, true, CycleMethod.NO_CYCLE, new Stop[] {
        new Stop(0,  Color.TRANSPARENT),
        new Stop(0.5,  Color.DARKGRAY),
        new Stop(0.64, Color.WHITESMOKE),
        new Stop(0.65, Color.YELLOW),
        new Stop(1, Color.GOLD)
    });
    Circle circle2 = new Circle(145, 45, 40, gradient2);

    HBox hb = new HBox(10);
    hb.getChildren().addAll(circle1, circle2);
    
    // show the circles
    getChildren().addAll(hb);
}
 
Example 4
Source Project: marathonv5   Source File: RadialGradientSample.java    License: Apache License 2.0 6 votes vote down vote up
public RadialGradientSample() {
    //create simple radial gradient
    RadialGradient gradient1 = new RadialGradient(0, 0, 0.5, 0.5, 1, true, CycleMethod.NO_CYCLE, new Stop[] {
        new Stop(0, Color.DODGERBLUE),
        new Stop(1, Color.BLACK)
    });
    Circle circle1 = new Circle(45, 45, 40, gradient1);

    //create complex radial gradient
    RadialGradient gradient2 = new RadialGradient(20, 1, 0.5, 0.5, 0.6, true, CycleMethod.NO_CYCLE, new Stop[] {
        new Stop(0,  Color.TRANSPARENT),
        new Stop(0.5,  Color.DARKGRAY),
        new Stop(0.64, Color.WHITESMOKE),
        new Stop(0.65, Color.YELLOW),
        new Stop(1, Color.GOLD)
    });
    Circle circle2 = new Circle(145, 45, 40, gradient2);

    HBox hb = new HBox(10);
    hb.getChildren().addAll(circle1, circle2);
    
    // show the circles
    getChildren().addAll(hb);
}
 
Example 5
Source Project: phoebus   Source File: ThermometerRepresentation.java    License: 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 6
Source Project: phoebus   Source File: ThermoDemo.java    License: Eclipse Public License 1.0 6 votes vote down vote up
Thermo(Color color)
{
    setFill(color);

    fill.setArcHeight(3);
    fill.setArcWidth(3);
    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);

    getChildren().add(border);
    getChildren().add(fill);
    getChildren().add(ellipse);
    setBorder(new Border(
            new BorderStroke(Color.BLACK, BorderStrokeStyle.SOLID, CornerRadii.EMPTY, BorderWidths.DEFAULT)));
}
 
Example 7
Source Project: charts   Source File: AreaHeatMap.java    License: Apache License 2.0 6 votes vote down vote up
private void draw(final int LIMIT, final double RESOLUTION) {
    int limit        = LIMIT > points.size() ? points.size() : LIMIT + 1;
    double pixelSize = 2 * RESOLUTION;

    ctx.clearRect(0, 0, width, height);

    for (double y = 0 ; y < height ; y += RESOLUTION) {
        for (double x = 0 ; x < width ; x += RESOLUTION) {
            double value = getValueAt(limit, x, y);
            if (value != -255) {
                Color          color    = getUseColorMapping() ? getColorForValue(value) : getColorForValue(value, isDiscreteColors());
                RadialGradient gradient = new RadialGradient(0, 0, x, y, RESOLUTION,
                                                             false, CycleMethod.NO_CYCLE,
                                                             new Stop(0, Color.color(color.getRed(), color.getGreen(), color.getBlue(), getHeatMapOpacity())),
                                                             new Stop(1, Color.color(color.getRed(), color.getGreen(), color.getBlue(), 0.0)));
                ctx.setFill(gradient);
                ctx.fillOval(x - RESOLUTION, y - RESOLUTION, pixelSize, pixelSize);
            }
        }
    }
}
 
Example 8
Source Project: tilesfx   Source File: SparkLineTileSkin.java    License: Apache License 2.0 6 votes vote down vote up
private void setupGradient() {
    double loFactor = (low - minValue) / tile.getRange();
    double hiFactor = (high - minValue) / tile.getRange();
    Stop   loStop   = new Stop(loFactor, gradientLookup.getColorAt(loFactor));
    Stop   hiStop   = new Stop(hiFactor, gradientLookup.getColorAt(hiFactor));

    List<Stop> stopsInBetween = gradientLookup.getStopsBetween(loFactor, hiFactor);

    double     range  = hiFactor - loFactor;
    double     factor = 1.0 / range;
    List<Stop> stops  = new ArrayList<>();
    stops.add(new Stop(0, loStop.getColor()));
    for (Stop stop : stopsInBetween) {
        stops.add(new Stop((stop.getOffset() - loFactor) * factor, stop.getColor()));
    }
    stops.add(new Stop(1, hiStop.getColor()));

    gradient = new LinearGradient(0, graphBounds.getY() + graphBounds.getHeight(), 0, graphBounds.getY(), false, CycleMethod.NO_CYCLE, stops);
}
 
Example 9
Source Project: tilesfx   Source File: GaugeSparkLineTileSkin.java    License: Apache License 2.0 6 votes vote down vote up
private void setupGradient() {
    double loFactor = (low - minValue) / tile.getRange();
    double hiFactor = (high - minValue) / tile.getRange();
    Stop   loStop   = new Stop(loFactor, gradientLookup.getColorAt(loFactor));
    Stop   hiStop   = new Stop(hiFactor, gradientLookup.getColorAt(hiFactor));

    List<Stop> stopsInBetween = gradientLookup.getStopsBetween(loFactor, hiFactor);

    double     range  = hiFactor - loFactor;
    double     factor = 1.0 / range;
    List<Stop> stops  = new ArrayList<>();
    stops.add(new Stop(0, loStop.getColor()));
    for (Stop stop : stopsInBetween) {
        stops.add(new Stop((stop.getOffset() - loFactor) * factor, stop.getColor()));
    }
    stops.add(new Stop(1, hiStop.getColor()));

    gradient = new LinearGradient(0, graphBounds.getY() + graphBounds.getHeight(), 0, graphBounds.getY(), false, CycleMethod.NO_CYCLE, stops);
}
 
Example 10
Source Project: Medusa   Source File: SectionSkin.java    License: Apache License 2.0 6 votes vote down vote up
private void createNeedle() {
    double needleWidth  = size * 0.04;
    double needleHeight = size * 0.4675;
    needle.getElements().clear();
    needle.getElements().add(new MoveTo(0.3125 * needleWidth, 0.015957446808510637 * needleHeight));
    needle.getElements().add(new CubicCurveTo(0.3125 * needleWidth, 0.005319148936170213 * needleHeight,
                                              0.4375 * needleWidth, 0.0,
                                              0.5 * needleWidth, 0.0));
    needle.getElements().add(new CubicCurveTo(0.5625 * needleWidth, 0.0,
                                              0.6875 * needleWidth, 0.005319148936170213 * needleHeight,
                                              0.6875 * needleWidth, 0.015957446808510637 * needleHeight));
    needle.getElements().add(new CubicCurveTo(0.6875 * needleWidth, 0.015957446808510637 * needleHeight,
                                              needleWidth, 0.9946808510638298 * needleHeight,
                                              needleWidth, 0.9946808510638298 * needleHeight));
    needle.getElements().add(new LineTo(0.0, 0.9946808510638298 * needleHeight));
    needle.getElements().add(new CubicCurveTo(0.0, 0.9946808510638298 * needleHeight,
                                              0.3125 * needleWidth, 0.015957446808510637 * needleHeight,
                                              0.3125 * needleWidth, 0.015957446808510637 * needleHeight));
    needle.getElements().add(new ClosePath());
    needle.setFill(new LinearGradient(needle.getLayoutBounds().getMinX(), 0,
                                      needle.getLayoutBounds().getMaxX(), 0,
                                      false, CycleMethod.NO_CYCLE,
                                      new Stop(0.0, gauge.getNeedleColor().darker()),
                                      new Stop(0.5, gauge.getNeedleColor()),
                                      new Stop(1.0, gauge.getNeedleColor().darker())));
}
 
Example 11
Source Project: Medusa   Source File: SectionSkin.java    License: Apache License 2.0 6 votes vote down vote up
@Override protected void redraw() {
    sectionsVisible = gauge.getSectionsVisible();
    drawSections();
    needle.setFill(new LinearGradient(needle.getLayoutBounds().getMinX(), 0,
                                      needle.getLayoutBounds().getMaxX(), 0,
                                      false, CycleMethod.NO_CYCLE,
                                      new Stop(0.0, gauge.getNeedleColor().darker()),
                                      new Stop(0.5, gauge.getNeedleColor()),
                                      new Stop(1.0, gauge.getNeedleColor().darker())));
    titleText.setFill(gauge.getTitleColor());
    valueText.setFill(gauge.getValueColor());
    mask.setFill(gauge.getBackgroundPaint());
    knob.setFill(gauge.getKnobColor());
    titleText.setText(gauge.getTitle());
    resizeText();
}
 
Example 12
Source Project: Medusa   Source File: ModernSkin.java    License: Apache License 2.0 6 votes vote down vote up
public void handleMouseEvent(final MouseEvent EVENT) {
    if (gauge.isDisabled()) return;
    final EventType TYPE = EVENT.getEventType();
    if (MouseEvent.MOUSE_PRESSED.equals(TYPE)) {
        gauge.fireEvent(gauge.BTN_PRESSED_EVENT);
        centerKnob.setFill(new LinearGradient(0.5 * size, 0.2708333333333333 * size,
                                              0.5 * size, 0.7291666666666666 * size,
                                              false, CycleMethod.NO_CYCLE,
                                              new Stop(0.0, Color.rgb(31, 31, 31)),
                                              new Stop(1.0, Color.rgb(69, 70, 73))));
        valueText.setTranslateY(size * 0.501);
        subTitleText.setTranslateY(size * 0.3525);
        unitText.setTranslateY(size * 0.6675);
    } else if (MouseEvent.MOUSE_RELEASED.equals(TYPE)) {
        gauge.fireEvent(gauge.BTN_RELEASED_EVENT);
        centerKnob.setFill(new LinearGradient(0.5 * size, 0.2708333333333333 * size,
                                              0.5 * size, 0.7291666666666666 * size,
                                              false, CycleMethod.NO_CYCLE,
                                              new Stop(0.0, Color.rgb(69, 70, 73)),
                                              new Stop(1.0, Color.rgb(31, 31, 31))));
        valueText.setTranslateY(size * 0.5);
        subTitleText.setTranslateY(size * 0.35);
        unitText.setTranslateY(size * 0.67);
    }
}
 
Example 13
Source Project: examples-javafx-repos1   Source File: Overlay1Controller.java    License: Apache License 2.0 6 votes vote down vote up
private void createTopHighlightBorder() {
    Stop[] stops = new Stop[] {
            new Stop(0, Color.WHITE),
            new Stop(.3, Color.LIGHTGRAY),
            new Stop(1, Color.TRANSPARENT)
    };
    LinearGradient lg1 = new LinearGradient(0, 0, 0, 1, true, CycleMethod.NO_CYCLE, stops);

    topHighlightBorder =
            new Border(new BorderStroke(
                    lg1, null, null, null,
                    BorderStrokeStyle.SOLID, BorderStrokeStyle.NONE, BorderStrokeStyle.NONE, BorderStrokeStyle.NONE,
                    CornerRadii.EMPTY,
                    new BorderWidths( 8.0d ),
                    null
            ));
}
 
Example 14
public void addMenuItem(final String iconPath,
    final EventHandler<MouseEvent> eventHandler) {

final RadialGradient backGradient = new RadialGradient(0, 0, 0, 0,
	radius.get(), false, CycleMethod.NO_CYCLE, new Stop(0,
		BACK_GRADIENT_COLOR), new Stop(1, Color.TRANSPARENT));

final RadialGradient backSelectGradient = new RadialGradient(0, 0, 0,
	0, radius.get(), false, CycleMethod.NO_CYCLE, new Stop(0,
		BACK_SELECT_GRADIENT_COLOR), new Stop(1,
		Color.TRANSPARENT));

final RadialMenuItem item = RadialMenuItemBuilder.create()
	.length(length).graphic(new Group(getImageView(iconPath)))
	.backgroundFill(backGradient)
	.backgroundMouseOnFill(backSelectGradient)
	.innerRadius(innerRadius).radius(radius).offset(offset)
	.clockwise(true).backgroundVisible(true).strokeVisible(false)
	.build();

item.setOnMouseClicked(eventHandler);

items.add(item);
itemsContainer.getChildren().addAll(item);
   }
 
Example 15
Source Project: constellation   Source File: OverviewPanel.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Helper method that creates and styles a POV object.
 *
 * The POV object is a styled rectangle that is used to indicate the
 * currently observed time range (aka time extent) on the timeline. It can
 * also be used to quickly interact with the time extent.
 *
 * @return A formatted POV object.
 */
private Rectangle createPOV() {
    final Rectangle rect = new Rectangle(135, 25, 60, 1);

    // Bind the height of the POV to the Height of the histogram:
    rect.yProperty().bind(histogram.heightProperty());
    rect.heightProperty().bind(innerPane.prefHeightProperty());
    rect.setManaged(true);

    // Style the rectangle:
    rect.setStroke(Color.DODGERBLUE);
    rect.setStrokeWidth(2d);
    final LinearGradient gradient
            = new LinearGradient(0.0, 0.0, 0.0, 0.5, true, CycleMethod.NO_CYCLE, new Stop[]{
        new Stop(0, Color.LIGHTBLUE.darker()),
        new Stop(1, Color.TRANSPARENT)
    });
    rect.setFill(gradient);
    rect.setSmooth(true);

    // Round the edges of the rectangle:
    rect.setArcWidth(5.0);
    rect.setArcHeight(5.0);

    // Set the POV mouse event handlers:
    final POVMouseEventHandler handler = new POVMouseEventHandler(rect);
    rect.setOnMouseMoved(handler);
    rect.setOnMousePressed(handler);
    rect.setOnMouseDragged(handler);
    rect.setOnMouseReleased(handler);

    // Make the POV object the top-most object on this panel:
    rect.toFront();

    return rect;
}
 
Example 16
Source Project: constellation   Source File: Cluster.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Constructs a new <code>ClusterRectangle</code> instance.
 */
public ClusterRectangle() {
    super(0, 0, 0, 40);

    // Round the edges of the rectangle:
    setArcWidth(5.0);
    setArcHeight(5.0);

    // Make slightly transparent:
    setOpacity(0.65);

    // Set a gradient for the percentage selected:
    final float percentage = 1 - (float) selectedCount / (float) count;

    if (anyNodesSelected && percentage == 1) {
        setStrokeWidth(3);
        setStroke(Color.YELLOW.deriveColor(0, 1, 1, 0.5));
    } else {
        setStrokeWidth(0);
    }

    // 'Blue' or unselected items represent 0% of the total:
    if (percentage == 0) {
        setFill(Color.RED.darker());
    } else {
        final LinearGradient gradient = new LinearGradient(0.0, 0.0, 0.0, percentage, true, CycleMethod.NO_CYCLE, new Stop[]{
            new Stop(percentage, Color.DODGERBLUE),
            new Stop(1, Color.RED.darker())
        });

        setFill(gradient);
    }
}
 
Example 17
Source Project: constellation   Source File: HeadingPane.java    License: Apache License 2.0 5 votes vote down vote up
private Shape makeSquare(Color colour, Color border) {
    Stop[] stops = new Stop[]{new Stop(0, colour), new Stop(0.95, colour.deriveColor(1, 1, .75, 1)), new Stop(1.0, colour.deriveColor(1, 1, 0.5, 1))};
    LinearGradient gradient = new LinearGradient(0, 0, 0, 1, true, CycleMethod.NO_CYCLE, stops);
    Rectangle square = new Rectangle(SQUARE_SIZE, SQUARE_SIZE);
    square.setStroke(border);
    square.setFill(gradient);
    return square;
}
 
Example 18
Source Project: chart-fx   Source File: ColormapSelector.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected void updateItem(final ColorGradient gradient, final boolean empty) {
    super.updateItem(gradient, empty);
    if (gradient == null || empty) {
        setGraphic(null);
        setText("-");
    } else {
        rect.setFill(new LinearGradient(0, 0, COLORMAP_WIDTH, 0, false, CycleMethod.NO_CYCLE, gradient.getStops()));
        setGraphic(rect);
        setText(gradient.toString());
    }
}
 
Example 19
Source Project: OEE-Designer   Source File: SparkLineTileSkin.java    License: MIT License 5 votes vote down vote up
private void setupGradient() {
    double loFactor = (low - minValue) / tile.getRange();
    double hiFactor = (high - minValue) / tile.getRange();
    Stop   loStop   = new Stop(loFactor, gradientLookup.getColorAt(loFactor));
    Stop   hiStop   = new Stop(hiFactor, gradientLookup.getColorAt(hiFactor));
    gradient = new LinearGradient(0, graphBounds.getY() + graphBounds.getHeight(), 0, graphBounds.getY(), false, CycleMethod.NO_CYCLE, loStop, hiStop);
}
 
Example 20
Source Project: OEE-Designer   Source File: GaugeSparkLineTileSkin.java    License: MIT License 5 votes vote down vote up
private void setupGradient() {
    double loFactor = (low - minValue) / tile.getRange();
    double hiFactor = (high - minValue) / tile.getRange();
    Stop   loStop   = new Stop(loFactor, gradientLookup.getColorAt(loFactor));
    Stop   hiStop   = new Stop(hiFactor, gradientLookup.getColorAt(hiFactor));
    gradient = new LinearGradient(0, graphBounds.getY() + graphBounds.getHeight(), 0, graphBounds.getY(), false, CycleMethod.NO_CYCLE, loStop, hiStop);
}
 
Example 21
Source Project: OEE-Designer   Source File: RadialPercentageTileSkin.java    License: MIT License 5 votes vote down vote up
@Override protected void redraw() {
    super.redraw();
    locale           = tile.getLocale();
    formatString     = new StringBuilder("%.").append(Integer.toString(tile.getDecimals())).append("f").toString();
    sectionsVisible  = tile.getSectionsVisible();

    barBackground.setStroke(tile.getBarBackgroundColor());

    LinearGradient gradient = new LinearGradient(0, 0, 1, 1, true, CycleMethod.NO_CYCLE, tile.getGradientStops());

    bar.setStroke(tile.isFillWithGradient() ? gradient : tile.getBarColor());
    proportionBar.setStroke(tile.isFillWithGradient() ? gradient : tile.getBarColor());
    percentageValueText.setFill(tile.getValueColor());
    percentageUnitText.setFill(tile.getUnitColor());
    descriptionText.setFill(tile.getDescriptionColor());
    unitText.setFill(tile.getUnitColor());
    titleText.setFill(tile.getTitleColor());
    text.setFill(tile.getTextColor());
    separator.setStroke(tile.getBackgroundColor());

    titleText.setText(tile.getTitle());
    descriptionText.setText(tile.getDescription());
    text.setText(tile.getText());
    unitText.setText(tile.getUnit());

    referenceValue = tile.getReferenceValue() < maxValue ? maxValue : tile.getReferenceValue();

    resizeStaticText();
    resizeDynamicText();
}
 
Example 22
Source Project: OEE-Designer   Source File: SmoothAreaChartTileSkin.java    License: MIT License 5 votes vote down vote up
@Override protected void redraw() {
    super.redraw();

    smoothing = tile.isSmoothing();

    titleText.setText(tile.getTitle());

    valueText.setText(String.format(locale, formatString, tile.getCurrentValue()));
    unitText.setText(tile.getUnit());

    resizeDynamicText();
    resizeStaticText();

    titleText.setFill(tile.getTitleColor());
    valueText.setFill(tile.getValueColor());
    unitText.setFill(tile.getUnitColor());
    selector.setStroke(tile.getForegroundColor());
    selector.setFill(tile.getBackgroundColor());
    Color fillPathColor1 = Helper.getColorWithOpacity(tile.getBarColor(), 0.7);
    Color fillPathColor2 = Helper.getColorWithOpacity(tile.getBarColor(), 0.1);
    if (tile.isFillWithGradient() && !tile.getGradientStops().isEmpty()) {
        fillPath.setFill(new LinearGradient(0, 0, 0, 1, true, CycleMethod.NO_CYCLE, tile.getGradientStops()));
        strokePath.setStroke(tile.getGradientStops().get(0).getColor());
        if (dataPointsVisible) { drawDataPoints(points, tile.getGradientStops().get(0).getColor()); }
    } else {
        fillPath.setFill(new LinearGradient(0, 0, 0, 1, true, CycleMethod.NO_CYCLE, new Stop(0, fillPathColor1), new Stop(1, fillPathColor2)));
        strokePath.setStroke(tile.getBarColor());
        if (dataPointsVisible) { drawDataPoints(points, tile.getBarColor()); }
    }
    drawChart(points);
}
 
Example 23
Source Project: marathonv5   Source File: SimpleHSBColorPicker.java    License: Apache License 2.0 5 votes vote down vote up
private LinearGradient buildHueBar() {
    double offset;
    Stop[] stops = new Stop[255];
    for (int y = 0; y < 255; y++) {
        offset = (double) (1.0 / 255) * y;
        int h = (int)((y / 255.0) * 360);
        stops[y] = new Stop(offset, Color.hsb(h, 1.0, 1.0));
    }
    return new LinearGradient(0f, 0f, 1f, 0f, true, CycleMethod.NO_CYCLE, stops);
}
 
Example 24
Source Project: marathonv5   Source File: StopWatchSample.java    License: Apache License 2.0 5 votes vote down vote up
private void configureDesign() {
    rectangleVisual.setLayoutY(0f);
    rectangleVisual.setLayoutX(-14);
    rectangleVisual.setFill(Color.TRANSPARENT);

    rectangleSmall.setLayoutX(-7);
    rectangleSmall.setLayoutY(5);
    rectangleSmall.setFill(new LinearGradient(0, 0, 1, 0, true, CycleMethod.NO_CYCLE, new Stop[]{
                new Stop(0, colorWeak),
                new Stop(0.5, colorStrong),
                new Stop(1, colorWeak)}));

    rectangleBig.setLayoutX(-14);
    rectangleBig.setLayoutY(0);
    rectangleBig.setFill(new LinearGradient(0, 0, 1, 0, true, CycleMethod.NO_CYCLE, new Stop[]{
                new Stop(0, colorStrong),
                new Stop(0.5, colorWeak),
                new Stop(1, colorStrong)}));

    rectangleWatch.setFill(new LinearGradient(0, 0, 1, 0, true, CycleMethod.NO_CYCLE, new Stop[]{
                new Stop(0, Color.web("#4e605f")),
                new Stop(0.2, Color.web("#c3d6d5")),
                new Stop(0.5, Color.web("#f9ffff")),
                new Stop(0.8, Color.web("#c3d6d5")),
                new Stop(1, Color.web("#4e605f"))}));
    rectangleWatch.setLayoutX(-12);
    rectangleWatch.setLayoutY(12);
}
 
Example 25
Source Project: marathonv5   Source File: LinearGradientSample.java    License: Apache License 2.0 5 votes vote down vote up
public LinearGradientSample() {
    //First rectangle
    Rectangle rect1 = new Rectangle(0,0,80,80);

    //create simple linear gradient
    LinearGradient gradient1 = new LinearGradient(0, 0, 1, 0, true, CycleMethod.NO_CYCLE, new Stop[] {
        new Stop(0, Color.DODGERBLUE),
        new Stop(1, Color.BLACK)
    });

    //set rectangle fill
    rect1.setFill(gradient1);

    // Second rectangle
    Rectangle rect2 = new Rectangle(0,0,80,80);

    //create complex linear gradient
    LinearGradient gradient2 = new LinearGradient(0, 0, 0, 0.5,  true, CycleMethod.REFLECT, new Stop[] {
        new Stop(0, Color.DODGERBLUE),
        new Stop(0.1, Color.BLACK),
        new Stop(1, Color.DODGERBLUE)
    });

    //set rectangle fill
    rect2.setFill(gradient2);

    // show the rectangles
    HBox hb = new HBox(10);
    hb.getChildren().addAll(rect1, rect2);
    getChildren().add(hb);
}
 
Example 26
Source Project: marathonv5   Source File: LinearGradientSample.java    License: Apache License 2.0 5 votes vote down vote up
public static Node createIconContent() {
    Rectangle rect = new Rectangle(80,80,new LinearGradient(0, 0, 1, 0, true, CycleMethod.NO_CYCLE, new Stop[] {
        new Stop(0, Color.rgb(156,216,255)),
        new Stop(0.5, Color.DODGERBLUE),
        new Stop(1, Color.rgb(0,70,140))
    }));
    rect.setArcWidth(20);
    rect.setArcHeight(20);
    return rect;
}
 
Example 27
Source Project: marathonv5   Source File: RadialGradientSample.java    License: Apache License 2.0 5 votes vote down vote up
public static Node createIconContent() {
    Rectangle rect = new Rectangle(80,80,new RadialGradient(0, 0, 0.5, 0.5, 1, true, CycleMethod.NO_CYCLE, new Stop[] {
        new Stop(0, Color.rgb(156,216,255)),
        new Stop(0.5, Color.DODGERBLUE),
        new Stop(1, Color.rgb(0,70,140))
    }));
    rect.setArcWidth(20);
    rect.setArcHeight(20);
    return rect;
}
 
Example 28
private void computeBack() {
final Rectangle rect = new Rectangle();
rect.setWidth(widthProp.get());
rect.setHeight(heightProp.get());
rect.setTranslateX(widthProp.get() / -2.0);
rect.setTranslateY(heightProp.get() / -2.0);

final RadialGradient radialGradient = new RadialGradient(0, 0,
	widthProp.get() / 2.0, heightProp.get() / 2.0,
	widthProp.get() / 2.0, false, CycleMethod.NO_CYCLE, new Stop(0,
		Color.TRANSPARENT), new Stop(1, BACK_GRADIENT_COLOR));

rect.setFill(radialGradient);
backContainer.getChildren().setAll(rect);
   }
 
Example 29
Source Project: marathonv5   Source File: SimpleHSBColorPicker.java    License: Apache License 2.0 5 votes vote down vote up
private LinearGradient buildHueBar() {
    double offset;
    Stop[] stops = new Stop[255];
    for (int y = 0; y < 255; y++) {
        offset = (double) (1.0 / 255) * y;
        int h = (int)((y / 255.0) * 360);
        stops[y] = new Stop(offset, Color.hsb(h, 1.0, 1.0));
    }
    return new LinearGradient(0f, 0f, 1f, 0f, true, CycleMethod.NO_CYCLE, stops);
}
 
Example 30
Source Project: marathonv5   Source File: StopWatchSample.java    License: Apache License 2.0 5 votes vote down vote up
private void configureDesign() {
    rectangleVisual.setLayoutY(0f);
    rectangleVisual.setLayoutX(-14);
    rectangleVisual.setFill(Color.TRANSPARENT);

    rectangleSmall.setLayoutX(-7);
    rectangleSmall.setLayoutY(5);
    rectangleSmall.setFill(new LinearGradient(0, 0, 1, 0, true, CycleMethod.NO_CYCLE, new Stop[]{
                new Stop(0, colorWeak),
                new Stop(0.5, colorStrong),
                new Stop(1, colorWeak)}));

    rectangleBig.setLayoutX(-14);
    rectangleBig.setLayoutY(0);
    rectangleBig.setFill(new LinearGradient(0, 0, 1, 0, true, CycleMethod.NO_CYCLE, new Stop[]{
                new Stop(0, colorStrong),
                new Stop(0.5, colorWeak),
                new Stop(1, colorStrong)}));

    rectangleWatch.setFill(new LinearGradient(0, 0, 1, 0, true, CycleMethod.NO_CYCLE, new Stop[]{
                new Stop(0, Color.web("#4e605f")),
                new Stop(0.2, Color.web("#c3d6d5")),
                new Stop(0.5, Color.web("#f9ffff")),
                new Stop(0.8, Color.web("#c3d6d5")),
                new Stop(1, Color.web("#4e605f"))}));
    rectangleWatch.setLayoutX(-12);
    rectangleWatch.setLayoutY(12);
}
 
Example 31
Source Project: marathonv5   Source File: LinearGradientSample.java    License: Apache License 2.0 5 votes vote down vote up
public LinearGradientSample() {
    //First rectangle
    Rectangle rect1 = new Rectangle(0,0,80,80);

    //create simple linear gradient
    LinearGradient gradient1 = new LinearGradient(0, 0, 1, 0, true, CycleMethod.NO_CYCLE, new Stop[] {
        new Stop(0, Color.DODGERBLUE),
        new Stop(1, Color.BLACK)
    });

    //set rectangle fill
    rect1.setFill(gradient1);

    // Second rectangle
    Rectangle rect2 = new Rectangle(0,0,80,80);

    //create complex linear gradient
    LinearGradient gradient2 = new LinearGradient(0, 0, 0, 0.5,  true, CycleMethod.REFLECT, new Stop[] {
        new Stop(0, Color.DODGERBLUE),
        new Stop(0.1, Color.BLACK),
        new Stop(1, Color.DODGERBLUE)
    });

    //set rectangle fill
    rect2.setFill(gradient2);

    // show the rectangles
    HBox hb = new HBox(10);
    hb.getChildren().addAll(rect1, rect2);
    getChildren().add(hb);
}
 
Example 32
Source Project: marathonv5   Source File: LinearGradientSample.java    License: Apache License 2.0 5 votes vote down vote up
public static Node createIconContent() {
    Rectangle rect = new Rectangle(80,80,new LinearGradient(0, 0, 1, 0, true, CycleMethod.NO_CYCLE, new Stop[] {
        new Stop(0, Color.rgb(156,216,255)),
        new Stop(0.5, Color.DODGERBLUE),
        new Stop(1, Color.rgb(0,70,140))
    }));
    rect.setArcWidth(20);
    rect.setArcHeight(20);
    return rect;
}
 
Example 33
Source Project: marathonv5   Source File: RadialGradientSample.java    License: Apache License 2.0 5 votes vote down vote up
public static Node createIconContent() {
    Rectangle rect = new Rectangle(80,80,new RadialGradient(0, 0, 0.5, 0.5, 1, true, CycleMethod.NO_CYCLE, new Stop[] {
        new Stop(0, Color.rgb(156,216,255)),
        new Stop(0.5, Color.DODGERBLUE),
        new Stop(1, Color.rgb(0,70,140))
    }));
    rect.setArcWidth(20);
    rect.setArcHeight(20);
    return rect;
}
 
Example 34
Source Project: marathonv5   Source File: ColorSample.java    License: Apache License 2.0 5 votes vote down vote up
public static Node createIconContent() {
    double offset;
    Stop[] stops = new Stop[255];
    for (int y = 0; y < 255; y++) {
        offset = (double) (1.0 / 255) * y;
        int h = (int)((y / 255.0) * 360);
        stops[y] = new Stop(offset, Color.hsb(h, 0.8, 0.9));
    }
    Rectangle rect = new Rectangle(80,80,
            new LinearGradient(0f, 0f, 1f, 1f, true, CycleMethod.NO_CYCLE, stops));
    rect.setArcWidth(20);
    rect.setArcHeight(20);
    return rect;
}
 
Example 35
Source Project: netbeans   Source File: StopWatch.java    License: Apache License 2.0 5 votes vote down vote up
private void configureDesign() {
    rectangleVisual.setLayoutY(0f);
    rectangleVisual.setLayoutX(-14);
    rectangleVisual.setFill(Color.TRANSPARENT);

    rectangleSmall.setLayoutX(-7);
    rectangleSmall.setLayoutY(5);
    rectangleSmall.setFill(new LinearGradient(0, 0, 1, 0, true, CycleMethod.NO_CYCLE, new Stop[]{
                new Stop(0, colorWeak),
                new Stop(0.5, colorStrong),
                new Stop(1, colorWeak)}));

    rectangleBig.setLayoutX(-14);
    rectangleBig.setLayoutY(0);
    rectangleBig.setFill(new LinearGradient(0, 0, 1, 0, true, CycleMethod.NO_CYCLE, new Stop[]{
                new Stop(0, colorStrong),
                new Stop(0.5, colorWeak),
                new Stop(1, colorStrong)}));

    rectangleWatch.setFill(new LinearGradient(0, 0, 1, 0, true, CycleMethod.NO_CYCLE, new Stop[]{
                new Stop(0, Color.web("#4e605f")),
                new Stop(0.2, Color.web("#c3d6d5")),
                new Stop(0.5, Color.web("#f9ffff")),
                new Stop(0.8, Color.web("#c3d6d5")),
                new Stop(1, Color.web("#4e605f"))}));
    rectangleWatch.setLayoutX(-12);
    rectangleWatch.setLayoutY(12);
}
 
Example 36
Source Project: phoebus   Source File: ThermometerRepresentation.java    License: Eclipse Public License 1.0 5 votes vote down vote up
public void setFill(Color color)
{
    ellipse.setFill(
            new RadialGradient(0, 0, 0.3, 0.1, 0.4, true, CycleMethod.NO_CYCLE,
                    new Stop(0, color.interpolate(Color.WHITESMOKE, 0.8)),
                    new Stop(1, color)));
    fill.setFill(new LinearGradient(0, 0, .8, 0, true, CycleMethod.NO_CYCLE,
            new Stop(0, color),
            new Stop(.3, color.interpolate(Color.WHITESMOKE, 0.7)),
            new Stop(1, color)));
}
 
Example 37
Source Project: phoebus   Source File: BaseLEDRepresentation.java    License: Eclipse Public License 1.0 5 votes vote down vote up
private Paint computeEditColors()
{
    final Color[] save_colors = colors;
    final List<Stop> stops = new ArrayList<>(2 * save_colors.length);
    final double offset = 1.0 / save_colors.length;

    for (int i = 0; i < save_colors.length; ++i)
    {
        stops.add(new Stop(i * offset, save_colors[i]));
        stops.add(new Stop((i + 1) * offset, save_colors[i]));
    }

    return new LinearGradient(0, 0, 1, 1, true, CycleMethod.NO_CYCLE, stops);
}
 
Example 38
Source Project: phoebus   Source File: ByteMonitorRepresentation.java    License: Eclipse Public License 1.0 5 votes vote down vote up
private Paint computeEditColors()
{
    final Color[] save_colors = colors;
    return new LinearGradient(0, 0, 1, 1, true, CycleMethod.NO_CYCLE,
            List.of(new Stop(0.0, save_colors[0]),
                    new Stop(0.5, save_colors[0]),
                    new Stop(0.5, save_colors[1]),
                    new Stop(1.0, save_colors[1])));
}
 
Example 39
Source Project: phoebus   Source File: BoolButtonRepresentation.java    License: Eclipse Public License 1.0 5 votes vote down vote up
private Paint computeEditColors()
{
    final Color[] save_colors = state_colors;
    return new LinearGradient(0, 0, 1, 1, true, CycleMethod.NO_CYCLE,
        List.of(new Stop(0.0, save_colors[0]),
                new Stop(0.5, save_colors[0]),
                new Stop(0.5, save_colors[1]),
                new Stop(1.0, save_colors[1])));
}
 
Example 40
Source Project: phoebus   Source File: ThermoDemo.java    License: Eclipse Public License 1.0 5 votes vote down vote up
public void setFill(Color color)
{
    ellipse.setFill(
            new RadialGradient(0, 0, 0.3, 0.1, 0.4, true, CycleMethod.NO_CYCLE,
                    new Stop(0, color.interpolate(Color.WHITESMOKE, 0.8)),
                    new Stop(1, color)));
    fill.setFill(new LinearGradient(0, 0, .8, 0, true, CycleMethod.NO_CYCLE,
                    new Stop(0, color),
                    new Stop(.3, color.interpolate(Color.WHITESMOKE, 0.7)),
                    new Stop(1, color)));
}