Java Code Examples for javafx.scene.shape.Circle#setStrokeType()

The following examples show how to use javafx.scene.shape.Circle#setStrokeType() . 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: Indicator.java    From tilesfx with Apache License 2.0 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);
        }
    }

    getStyleClass().add("indicator");

    ring = new Circle(PREFERRED_WIDTH * 0.5);
    ring.setStrokeType(StrokeType.INSIDE);
    ring.setStrokeWidth(PREFERRED_WIDTH * 0.078125);
    ring.setStroke(getRingColor());
    ring.setFill(Color.TRANSPARENT);

    dot = new Circle(PREFERRED_WIDTH * 0.3125);
    dot.setFill(getDotOnColor());

    pane = new Pane(ring, dot);

    getChildren().setAll(pane);
}
 
Example 2
Source File: CalibrationButton.java    From tet-java-client with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private void init()
{
    Group g = new Group();

    mCircle = new Circle(0,0,40);
    mCircle.setFill(Color.WHITE);
    mCircle.setStrokeWidth(3);
    mCircle.setStrokeMiterLimit(10);
    mCircle.setStrokeType(StrokeType.CENTERED);
    mCircle.setStroke(Color.valueOf("0x333333"));

    Circle inner = new Circle(0,0,8);
    inner.setFill(Color.valueOf("0xFFFFFF00"));
    inner.setStrokeWidth(4);
    inner.setStrokeMiterLimit(10);
    inner.setStrokeType(StrokeType.INSIDE);
    inner.setStroke(Color.valueOf("0x000000"));

    g.getChildren().addAll(mCircle, inner);
    setAlignment(g, Pos.CENTER);

    getChildren().add(g);
}
 
Example 3
Source File: Dialogs.java    From helloiot with GNU General Public License v3.0 5 votes vote down vote up
public static Node createLoadingNode () {
    
    Circle c0 = new Circle(65);
    c0.setFill(Color.TRANSPARENT);
    c0.setStrokeWidth(0.0);

    Circle c1 = new Circle(50);
    c1.setFill(Color.TRANSPARENT);
    c1.setStrokeType(StrokeType.INSIDE);
    c1.setStrokeLineCap(StrokeLineCap.BUTT);
    c1.getStrokeDashArray().addAll(78.54); // 50 * 2 * 3.1416 / 4
    c1.setCache(true);
    c1.setCacheHint(CacheHint.ROTATE);   
    c1.getStyleClass().add("loading-circle");
    setRotate(c1, true, 440.0, 10);

    Circle c2 = new Circle(40);
    c2.setFill(Color.TRANSPARENT);
    c2.setStrokeType(StrokeType.INSIDE);
    c2.setStrokeLineCap(StrokeLineCap.BUTT);
    c2.getStrokeDashArray().addAll(41.89); // 40 * 2 * 3.1416 / 6
    c2.setCache(true);
    c2.setCacheHint(CacheHint.ROTATE);    
    c2.getStyleClass().add("loading-circle");
    setRotate(c2, true, 360.0, 14);

    Circle c3 = new Circle(30);
    c3.setFill(Color.TRANSPARENT);
    c3.setStrokeType(StrokeType.INSIDE);
    c3.setStrokeLineCap(StrokeLineCap.BUTT);        
    c3.getStyleClass().add("loading-circle");

    Group g = new Group(c0, c1, c2, c3);
    g.getStylesheets().add(Dialogs.class.getResource("/com/adr/helloiot/styles/loading.css").toExternalForm());
    
    return g;
}
 
Example 4
Source File: Dialogs.java    From helloiot with GNU General Public License v3.0 5 votes vote down vote up
public static Node createSmallLoadingNode () {
    
    Circle c0 = new Circle(45);
    c0.setFill(Color.TRANSPARENT);
    c0.setStrokeWidth(0.0);

    Circle c2 = new Circle(40);
    c2.setFill(Color.TRANSPARENT);
    c2.setStrokeType(StrokeType.INSIDE);
    c2.setStrokeLineCap(StrokeLineCap.BUTT);
    c2.getStrokeDashArray().addAll(41.89); // 40 * 2 * 3.1416 / 6
    c2.setCache(true);
    c2.setCacheHint(CacheHint.ROTATE);    
    c2.getStyleClass().add("loading-circle");
    setRotate(c2, true, 360.0, 14);

    Circle c3 = new Circle(30);
    c3.setFill(Color.TRANSPARENT);
    c3.setStrokeType(StrokeType.INSIDE);
    c3.setStrokeLineCap(StrokeLineCap.BUTT);        
    c3.getStyleClass().add("loading-circle");

    Group g = new Group(c0, c2, c3);
    g.getStylesheets().add(Dialogs.class.getResource("/com/adr/helloiot/styles/loading.css").toExternalForm());
    
    return g;
}
 
Example 5
Source File: CircleSegmentHandlePart.java    From gef with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Creates the visual representation of this selection handle.
 *
 * @return {@link Node} representing the handle visually
 */
@Override
protected Circle doCreateVisual() {
	Circle circle = new Circle(DEFAULT_SIZE / 2d);
	// initialize invariant visual properties
	circle.setStroke(getStroke());
	circle.setFill(getMoveFill());
	circle.setStrokeWidth(1);
	circle.setStrokeType(StrokeType.OUTSIDE);
	return circle;
}
 
Example 6
Source File: SlimClockSkin.java    From Medusa with Apache License 2.0 4 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);
        }
    }

    ZonedDateTime time = clock.getTime();

    secondBackgroundCircle = new Circle(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, PREFERRED_WIDTH * 0.48);
    secondBackgroundCircle.setStrokeWidth(PREFERRED_WIDTH * 0.008);
    secondBackgroundCircle.setStrokeType(StrokeType.CENTERED);
    secondBackgroundCircle.setStrokeLineCap(StrokeLineCap.ROUND);
    secondBackgroundCircle.setFill(null);
    secondBackgroundCircle.setStroke(Helper.getTranslucentColorFrom(clock.getSecondColor(), 0.2));
    secondBackgroundCircle.setVisible(clock.isSecondsVisible());
    secondBackgroundCircle.setManaged(clock.isSecondsVisible());

    dateText = new Text(dateTextFormatter.format(time));
    dateText.setVisible(clock.isDayVisible());
    dateText.setManaged(clock.isDayVisible());

    dateNumbers = new Text(dateNumberFormatter.format(time));
    dateNumbers.setVisible(clock.isDateVisible());
    dateNumbers.setManaged(clock.isDateVisible());

    hour = new Text(HOUR_FORMATTER.format(time));
    hour.setFill(clock.getHourColor());

    minute = new Text(MINUTE_FORMATTER.format(time));
    minute.setFill(clock.getMinuteColor());

    secondArc = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, PREFERRED_WIDTH * 0.96, PREFERRED_WIDTH * 0.48, 90, (-6 * clock.getTime().getSecond()));
    secondArc.setStrokeWidth(PREFERRED_WIDTH * 0.008);
    secondArc.setStrokeType(StrokeType.CENTERED);
    secondArc.setStrokeLineCap(StrokeLineCap.ROUND);
    secondArc.setFill(null);
    secondArc.setStroke(clock.getSecondColor());
    secondArc.setVisible(clock.isSecondsVisible());
    secondArc.setManaged(clock.isSecondsVisible());

    pane = new Pane(secondBackgroundCircle, dateText, dateNumbers, hour, minute, secondArc);
    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 7
Source File: MinimalClockSkin.java    From Medusa with Apache License 2.0 4 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);
        }
    }

    ZonedDateTime time = clock.getTime();

    secondBackgroundCircle = new Circle(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, PREFERRED_WIDTH * 0.48);
    secondBackgroundCircle.setStrokeWidth(PREFERRED_WIDTH * 0.008);
    secondBackgroundCircle.setStrokeType(StrokeType.CENTERED);
    secondBackgroundCircle.setStrokeLineCap(StrokeLineCap.ROUND);
    secondBackgroundCircle.setFill(null);
    secondBackgroundCircle.setStroke(Helper.getTranslucentColorFrom(clock.getSecondColor(), 0.2));
    secondBackgroundCircle.setVisible(clock.isSecondsVisible());
    secondBackgroundCircle.setManaged(clock.isSecondsVisible());

    dateText = new Text(dateTextFormatter.format(time));
    dateText.setVisible(clock.isDateVisible());
    dateText.setManaged(clock.isDateVisible());

    hour = new Text(HOUR_FORMATTER.format(time));
    hour.setFill(clock.getHourColor());

    minute = new Text(MINUTE_FORMATTER.format(time));
    minute.setFill(clock.getMinuteColor());

    minuteCircle = new Circle(0.075 * PREFERRED_WIDTH);

    secondArc = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, PREFERRED_WIDTH * 0.96, PREFERRED_WIDTH * 0.48, 90, (-6 * clock.getTime().getSecond()));
    secondArc.setStrokeWidth(PREFERRED_WIDTH * 0.008);
    secondArc.setStrokeType(StrokeType.CENTERED);
    secondArc.setStrokeLineCap(StrokeLineCap.BUTT);
    secondArc.setFill(null);
    secondArc.setStroke(clock.getSecondColor());
    secondArc.setVisible(clock.isSecondsVisible());
    secondArc.setManaged(clock.isSecondsVisible());

    pane = new Pane(secondBackgroundCircle, dateText, hour, secondArc, minuteCircle, minute);
    pane.setBackground(new Background(new BackgroundFill(clock.getBackgroundPaint(), new CornerRadii(1024), new Insets(PREFERRED_WIDTH * 0.04))));

    getChildren().setAll(pane);
}