下面列出了怎么用javafx.scene.shape.Circle的API类实例代码及写法,或者点击链接到github查看源代码。
@Override
public void initializeParts() {
double center = ARTBOARD_HEIGHT * 0.5;
border = new Circle(center, center, center);
border.getStyleClass().add("border");
pieSlice = new Arc(center, center, center - 1, center - 1, 90, 0);
pieSlice.getStyleClass().add("pieSlice");
pieSlice.setType(ArcType.ROUND);
valueField = new TextField();
valueField.relocate(ARTBOARD_HEIGHT + 5, 2);
valueField.setPrefWidth(ARTBOARD_WIDTH - ARTBOARD_HEIGHT - 5);
valueField.getStyleClass().add("valueField");
// always needed
drawingPane = new Pane();
drawingPane.setMaxSize(ARTBOARD_WIDTH, ARTBOARD_HEIGHT);
drawingPane.setMinSize(ARTBOARD_WIDTH, ARTBOARD_HEIGHT);
drawingPane.setPrefSize(ARTBOARD_WIDTH, ARTBOARD_HEIGHT);
}
@Override
public Node icon() {
Image image = new Image(getClass().getResource("/com/gn/media/img/avatar.png").toExternalForm());
ImageView imageView = new ImageView(image);
imageView.setFitHeight(30);
imageView.setFitWidth(30);
Circle circle = new Circle(12);
circle.setStroke(Color.WHITE);
circle.setStrokeWidth(5);
circle.setCenterX(imageView.getFitWidth() / 2);
circle.setCenterY(imageView.getFitHeight() / 2);
imageView.setClip(circle);
return imageView;
}
public EyesView(Narjillo narjillo) {
this.narjillo = narjillo;
Fiber fiber = narjillo.getBody().getHead().getFiber();
this.eyeRed = fiber.getPercentOfRed();
this.eyeGreen = fiber.getPercentOfGreen();
this.eyeBlue = fiber.getPercentOfBlue();
// "Random qualities": we want something that looks random across narjillos,
// but stays the same for the same narjillo even after saving and reloading
double someRandomQuality = narjillo.getBody().getAdultMass();
double someOtherRandomQuality = narjillo.getBody().getEnergyToChildren();
this.eye1 = new Circle(someRandomQuality % 5 + 7);
this.eye2 = new Circle(someOtherRandomQuality % 5 + 7);
this.pupil1 = new Circle(Math.min(eye1.getRadius() - 2, someRandomQuality % 6 + 1));
this.pupil2 = new Circle(Math.min(eye1.getRadius() - 2, someOtherRandomQuality % 6 + 1));
eyeCenteringTranslation = eye1.getRadius() - eye2.getRadius();
pupilTranslation = Math.min(eye2.getRadius() - pupil2.getRadius(), eye1.getRadius() - pupil1.getRadius());
this.eye1.getTransforms().add(new Translate(eyeCenteringTranslation - eye1.getRadius() + 1, 0));
this.eye2.getTransforms().add(new Translate(eyeCenteringTranslation + eye2.getRadius() - 1, 0));
}
private void setLevel(int levelNum) {
getGameWorld().getEntitiesCopy().forEach(e -> e.removeFromWorld());
setLevelFromMap("tmx/level" + levelNum + ".tmx");
var ball = spawn("ball", getAppWidth() / 2, getAppHeight() - 250);
ball.getComponent(BallComponent.class).colorProperty().addListener((obs, old, newValue) -> {
var circle = (Circle) getGameWorld().getSingleton(COLOR_CIRCLE).getViewComponent().getChildren().get(0);
circle.setFill(getBallControl().getNextColor());
});
spawn("bat", getAppWidth() / 2, getAppHeight() - 180);
animateCamera(() -> {
getSceneService().pushSubScene(new NewLevelSubScene(levelNum));
getBallControl().release();
});
}
public TranslateTransitionSample() {
super(400,40);
Circle circle = new Circle(20, Color.CRIMSON);
circle.setTranslateX(20);
circle.setTranslateY(20);
getChildren().add(circle);
translateTransition = new TranslateTransition(Duration.seconds(4),circle);
translateTransition.setFromX(20);
translateTransition.setToX(380);
translateTransition.setCycleCount(Timeline.INDEFINITE);
translateTransition.setAutoReverse(true);
translateTransition = TranslateTransitionBuilder.create()
.duration(Duration.seconds(4))
.node(circle)
.fromX(20)
.toX(380)
.cycleCount(Timeline.INDEFINITE)
.autoReverse(true)
.build();
}
public CircleSample() {
super(180,90);
// Simple red filled circle
Circle circle1 = new Circle(45,45,40, Color.RED);
// Blue stroked circle
Circle circle2 = new Circle(135,45,40);
circle2.setStroke(Color.DODGERBLUE);
circle2.setFill(null);
// Create a group to show all the circles);
getChildren().add(new Group(circle1,circle2));
// REMOVE ME
setControls(
new SimplePropertySheet.PropDesc("Circle 1 Fill", circle1.fillProperty()),
new SimplePropertySheet.PropDesc("Circle 1 Radius", circle1.radiusProperty(), 10d, 40d),
new SimplePropertySheet.PropDesc("Circle 2 Stroke", circle2.strokeProperty()),
new SimplePropertySheet.PropDesc("Circle 2 Stroke Width", circle2.strokeWidthProperty(), 1d, 5d),
new SimplePropertySheet.PropDesc("Circle 2 Radius", circle2.radiusProperty(), 10d, 40d)
);
// END REMOVE ME
}
private void initGraphics() {
ring = new Circle(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5 , PREFERRED_WIDTH * 0.5);
ring.setFill(Color.TRANSPARENT);
ring.setStroke(color);
canvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT);
ctx = canvas.getGraphicsContext2D();
ctx.setFill(color);
mask = new Circle(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, PREFERRED_WIDTH * 0.45);
canvas.setClip(mask);
text = new Text(String.format(Locale.US, "%.0f%%", gauge.getCurrentValue()));
text.setFill(darkerColor);
text.setTextOrigin(VPos.CENTER);
pane = new Pane(ring, canvas, text);
getChildren().setAll(pane);
}
public LoadingCircle() {
Circle circle = new Circle(20);
circle.setFill(null);
circle.setStroke(Color.WHITE);
circle.setStrokeWidth(2);
Rectangle rect = new Rectangle(20, 20);
Shape shape = Shape.subtract(circle, rect);
shape.setFill(Color.WHITE);
getChildren().add(shape);
animation = new RotateTransition(Duration.seconds(2.5), this);
animation.setByAngle(-360);
animation.setInterpolator(Interpolator.LINEAR);
animation.setCycleCount(Animation.INDEFINITE);
animation.play();
}
private void buildUI(Image image, double x, double y)
{
setPrefWidth(image.getWidth());
setPrefHeight(image.getHeight());
iconView = new ImageView(image);
setStyle("-fx-background-color:rgba(0,0,0,0);");
iconCircle = new Circle(image.getWidth()/2+10);
iconCircle.setCenterX(getPrefWidth() / 2);
iconCircle.setCenterY(getPrefHeight() / 2);
iconCircle.getStyleClass().add("dockzone-circle-selector");
iconView.relocate((getPrefWidth()-image.getWidth()) / 2, (getPrefWidth()-image.getHeight()) / 2);
getChildren().addAll(iconCircle,iconView);
parent.getChildren().add(this);
relocate(x, y);
}
public CircleSample() {
super(180,90);
// Simple red filled circle
Circle circle1 = new Circle(45,45,40, Color.RED);
// Blue stroked circle
Circle circle2 = new Circle(135,45,40);
circle2.setStroke(Color.DODGERBLUE);
circle2.setFill(null);
// Create a group to show all the circles);
getChildren().add(new Group(circle1,circle2));
// REMOVE ME
setControls(
new SimplePropertySheet.PropDesc("Circle 1 Fill", circle1.fillProperty()),
new SimplePropertySheet.PropDesc("Circle 1 Radius", circle1.radiusProperty(), 10d, 40d),
new SimplePropertySheet.PropDesc("Circle 2 Stroke", circle2.strokeProperty()),
new SimplePropertySheet.PropDesc("Circle 2 Stroke Width", circle2.strokeWidthProperty(), 1d, 5d),
new SimplePropertySheet.PropDesc("Circle 2 Radius", circle2.radiusProperty(), 10d, 40d)
);
// END REMOVE ME
}
@Override protected void initGraphics() {
super.initGraphics();
titleText = new Text();
titleText.setFill(tile.getTitleColor());
Helper.enableNode(titleText, !tile.getTitle().isEmpty());
text = new Text(tile.getText());
text.setFill(tile.getUnitColor());
Helper.enableNode(text, tile.isTextVisible());
description = new Label(tile.getDescription());
description.setAlignment(tile.getDescriptionAlignment());
description.setWrapText(true);
description.setTextFill(tile.getTextColor());
Helper.enableNode(description, !tile.getDescription().isEmpty());
ledBorder = new Circle();
led = new Circle();
hightlight = new Circle();
innerShadow = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.65), 0.07 * size, 0, 0, 0);
led.setEffect(innerShadow);
getPane().getChildren().addAll(titleText, text, description, ledBorder, led, hightlight);
}
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);
}
@Spawns("player")
public Entity newPlayer(SpawnData data) {
PhysicsComponent physics = new PhysicsComponent();
physics.setBodyType(BodyType.DYNAMIC);
Texture staticTexture = FXGL.getAssetLoader()
.loadTexture("dude.png")
.subTexture(new Rectangle2D(0, 0, 32, 42));
Texture animatedTexture = FXGL.getAssetLoader()
.loadTexture("dude.png")
.toAnimatedTexture(4, Duration.seconds(1));
return FXGL.entityBuilder()
.at(data.getX(), data.getY())
.type(ScifiType.PLAYER)
.bbox(new HitBox("main", BoundingShape.circle(19)))
.view(new Circle(19, 19, 19, Color.BLUE))
.with(physics)
//.with(new PlayerComponent(staticTexture, animatedTexture))
.build();
}
@Spawns("key")
public Entity newKey(SpawnData data) {
PhysicsComponent physics = new PhysicsComponent();
physics.setBodyType(BodyType.DYNAMIC);
FixtureDef fd = new FixtureDef();
fd.setDensity(0.03f);
physics.setFixtureDef(fd);
return FXGL.entityBuilder()
.at(data.getX(), data.getY())
.type(ScifiType.KEY)
.viewWithBBox(new Circle(10, 10, 10, Color.GOLD))
.with(physics)
.build();
}
private void setLevel(int levelNum) {
getGameWorld().getEntitiesCopy().forEach(e -> e.removeFromWorld());
setLevelFromMap("tmx/level" + levelNum + ".tmx");
var ball = spawn("ball", getAppWidth() / 2, getAppHeight() - 250);
ball.getComponent(BallComponent.class).colorProperty().addListener((obs, old, newValue) -> {
var circle = (Circle) getGameWorld().getSingleton(COLOR_CIRCLE).getViewComponent().getChildren().get(0);
circle.setFill(getBallControl().getNextColor());
});
spawn("bat", getAppWidth() / 2, getAppHeight() - 180);
animateCamera(() -> {
getSceneService().pushSubScene(new NewLevelSubScene(levelNum));
getBallControl().release();
});
}
public static String convertCircle(final Circle CIRCLE) {
final StringBuilder fxPath = new StringBuilder();
final double CENTER_X = CIRCLE.getCenterX() == 0 ? CIRCLE.getRadius() : CIRCLE.getCenterX();
final double CENTER_Y = CIRCLE.getCenterY() == 0 ? CIRCLE.getRadius() : CIRCLE.getCenterY();
final double RADIUS = CIRCLE.getRadius();
final double CONTROL_DISTANCE = RADIUS * KAPPA;
// Move to first point
fxPath.append("M ").append(CENTER_X).append(" ").append(CENTER_Y - RADIUS).append(" ");
// 1. quadrant
fxPath.append("C ").append(CENTER_X + CONTROL_DISTANCE).append(" ").append(CENTER_Y - RADIUS).append(" ")
.append(CENTER_X + RADIUS).append(" ").append(CENTER_Y - CONTROL_DISTANCE).append(" ")
.append(CENTER_X + RADIUS).append(" ").append(CENTER_Y).append(" ");
// 2. quadrant
fxPath.append("C ").append(CENTER_X + RADIUS).append(" ").append(CENTER_Y + CONTROL_DISTANCE).append(" ")
.append(CENTER_X + CONTROL_DISTANCE).append(" ").append(CENTER_Y + RADIUS).append(" ")
.append(CENTER_X).append(" ").append(CENTER_Y + RADIUS).append(" ");
// 3. quadrant
fxPath.append("C ").append(CENTER_X - CONTROL_DISTANCE).append(" ").append(CENTER_Y + RADIUS).append(" ")
.append(CENTER_X - RADIUS).append(" ").append(CENTER_Y + CONTROL_DISTANCE).append(" ")
.append(CENTER_X - RADIUS).append(" ").append(CENTER_Y).append(" ");
// 4. quadrant
fxPath.append("C ").append(CENTER_X - RADIUS).append(" ").append(CENTER_Y - CONTROL_DISTANCE).append(" ")
.append(CENTER_X - CONTROL_DISTANCE).append(" ").append(CENTER_Y - RADIUS).append(" ")
.append(CENTER_X).append(" ").append(CENTER_Y - RADIUS).append(" ");
// Close path
fxPath.append("Z");
return fxPath.toString();
}
public LedController(GridPane ledPane, Machine machine) {
this.machine = machine;
for (int i = 0; i < 16; i++) {
circles[i] = new Circle(3);
circles[i].setFill(Color.GRAY);
ledPane.add(circles[i], i, 0);
}
TimingRenderer.register(this);
}
@TestFx
public void testLegendItemSetterGetter() {
Node symbol1 = new Rectangle();
Node symbol2 = new Circle();
assertDoesNotThrow(() -> new LegendItem("test", symbol1));
LegendItem legendItem = new LegendItem("test", symbol1);
assertEquals("test", legendItem.getText());
assertEquals(symbol1, legendItem.getSymbol());
assertDoesNotThrow(() -> legendItem.setSymbol(symbol2));
assertEquals(symbol2, legendItem.getSymbol());
}
private void updateColor() {
final ColorPicker colorPicker = (ColorPicker) getSkinnable();
Color color = colorPicker.getValue();
Color circleColor = color == null ? Color.WHITE : color;
// update picker box color
if (((JFXColorPicker) getSkinnable()).isDisableAnimation()) {
JFXNodeUtils.updateBackground(colorBox.getBackground(), colorBox, circleColor);
} else {
Circle colorCircle = new Circle();
colorCircle.setFill(circleColor);
colorCircle.setManaged(false);
colorCircle.setLayoutX(colorBox.getWidth() / 4);
colorCircle.setLayoutY(colorBox.getHeight() / 2);
colorBox.getChildren().add(colorCircle);
Timeline animateColor = new Timeline(new KeyFrame(Duration.millis(240),
new KeyValue(colorCircle.radiusProperty(),
200,
Interpolator.EASE_BOTH)));
animateColor.setOnFinished((finish) -> {
JFXNodeUtils.updateBackground(colorBox.getBackground(), colorBox, colorCircle.getFill());
colorBox.getChildren().remove(colorCircle);
});
animateColor.play();
}
// 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("");
}
}
private static Pane getDemoPane() {
final Rectangle rect = new Rectangle(-130, -40, 80, 80);
rect.setFill(Color.BLUE);
final Circle circle = new Circle(0, 0, 40);
circle.setFill(Color.GREEN);
final Polygon triangle = new Polygon(60, -40, 120, 0, 50, 40);
triangle.setFill(Color.RED);
final Group group = new Group(rect, circle, triangle);
group.setTranslateX(300);
group.setTranslateY(200);
final RotateTransition rotateTransition = new RotateTransition(Duration.millis(4000), group);
rotateTransition.setByAngle(3.0 * 360);
rotateTransition.setCycleCount(Animation.INDEFINITE);
rotateTransition.setAutoReverse(true);
rotateTransition.play();
final RotateTransition rotateTransition1 = new RotateTransition(Duration.millis(1000), rect);
rotateTransition1.setByAngle(360);
rotateTransition1.setCycleCount(Animation.INDEFINITE);
rotateTransition1.setAutoReverse(false);
rotateTransition1.play();
final RotateTransition rotateTransition2 = new RotateTransition(Duration.millis(1000), triangle);
rotateTransition2.setByAngle(360);
rotateTransition2.setCycleCount(Animation.INDEFINITE);
rotateTransition2.setAutoReverse(false);
rotateTransition2.play();
group.setManaged(true);
HBox.setHgrow(group, Priority.ALWAYS);
final HBox box = new HBox(group);
VBox.setVgrow(box, Priority.ALWAYS);
box.setId("demoPane");
return box;
}
@Override // Override the start method in the Application class
public void start(Stage primaryStage) {
// Create a Stack pane
StackPane pane = new StackPane();
// Create a circle and set its properties
Circle circle = new Circle(50);
circle.setFill(Color.WHITE);
circle.setStroke(Color.BLACK);
pane.getChildren().add(circle);
// Create and register the handler
pane.setOnMousePressed(e -> {
circle.setFill(Color.BLACK);
});
pane.setOnMouseReleased(e -> {
circle.setFill(Color.WHITE);
circle.setStroke(Color.BLACK);
});
// Create a scene and place it in the stage
Scene scene = new Scene(pane, 120, 120);
primaryStage.setTitle("Exercise_15_07"); // Set the stage title
primaryStage.setScene(scene); // Place the scene in the stage
primaryStage.show(); // Display the stage
}
@Override
public void initializeParts() {
value = new Text(0, ARTBOARD_HEIGHT * 0.5, String.format(FORMAT, getSkinnable().getValue()));
value.getStyleClass().add("value");
value.setTextOrigin(VPos.CENTER);
value.setTextAlignment(TextAlignment.CENTER);
value.setMouseTransparent(true);
value.setWrappingWidth(ARTBOARD_HEIGHT);
value.setBoundsType(TextBoundsType.VISUAL);
thumb = new Circle(ARTBOARD_HEIGHT * 0.5, ARTBOARD_HEIGHT * 0.5, ARTBOARD_HEIGHT * 0.5);
thumb.getStyleClass().add("thumb");
thumbGroup = new Group(thumb, value);
valueBar = new Line();
valueBar.getStyleClass().add("valueBar");
valueBar.setStrokeLineCap(StrokeLineCap.ROUND);
applyCss(valueBar);
strokeWidthFromCSS = valueBar.getStrokeWidth();
scale = new Line();
scale.getStyleClass().add("scale");
scale.setStrokeLineCap(StrokeLineCap.ROUND);
// always needed
drawingPane = new Pane();
}
private void updateMarkers() {
markerMap.clear();
for (Marker marker : gauge.getMarkers()) {
switch(marker.getMarkerType()) {
case TRIANGLE: markerMap.put(marker, new Path()); break;
case DOT : markerMap.put(marker, new Circle()); break;
case STANDARD:
default: markerMap.put(marker, new Path()); break;
}
}
}
/** Set a circle with a random color and a random location the pane */
private void setRandomProperties(Circle c, double width, double height) {
c.setFill(Color.color(Math.random(), Math.random(), Math.random()));
c.setCenterX(c.getRadius() + Math.random() *
(width - c.getRadius() * 2));
c.setCenterY(c.getRadius() + Math.random() *
(height - c.getRadius() * 2));
}
private void updateMarkers() {
markerMap.clear();
for (Marker marker : gauge.getMarkers()) {
switch(marker.getMarkerType()) {
case TRIANGLE: markerMap.put(marker, new Path()); break;
case DOT : markerMap.put(marker, new Circle()); break;
case STANDARD:
default: markerMap.put(marker, new Path()); break;
}
}
}
public HangmanImage() {
Circle head = new Circle(20);
head.setTranslateX(SPINE_START_X);
Line spine = new Line();
spine.setStartX(SPINE_START_X);
spine.setStartY(SPINE_START_Y);
spine.setEndX(SPINE_END_X);
spine.setEndY(SPINE_END_Y);
Line leftArm = new Line();
leftArm.setStartX(SPINE_START_X);
leftArm.setStartY(SPINE_START_Y);
leftArm.setEndX(SPINE_START_X + 40);
leftArm.setEndY(SPINE_START_Y + 10);
Line rightArm = new Line();
rightArm.setStartX(SPINE_START_X);
rightArm.setStartY(SPINE_START_Y);
rightArm.setEndX(SPINE_START_X - 40);
rightArm.setEndY(SPINE_START_Y + 10);
Line leftLeg = new Line();
leftLeg.setStartX(SPINE_END_X);
leftLeg.setStartY(SPINE_END_Y);
leftLeg.setEndX(SPINE_END_X + 25);
leftLeg.setEndY(SPINE_END_Y + 50);
Line rightLeg = new Line();
rightLeg.setStartX(SPINE_END_X);
rightLeg.setStartY(SPINE_END_Y);
rightLeg.setEndX(SPINE_END_X - 25);
rightLeg.setEndY(SPINE_END_Y + 50);
getChildren().addAll(head, spine, leftArm, rightArm, leftLeg, rightLeg);
lives.set(getChildren().size());
}
@Override
public void start(Stage stage) {
Pane canvas = new Pane();
Scene scene = new Scene(canvas, 500, 500);
Circle ball = new Circle(10, Color.RED);
ball.setLayoutX(10);
ball.setLayoutY(10);
canvas.getChildren().add(ball);
List<Circle> apples = generateApples();
canvas.getChildren().addAll(apples);
// scene.addEventFilter(KeyEvent.KEY_PRESSED,
// event -> {
// int deltaX = 0;
// int deltaY = 0;
// switch (event.getCode()) {
// case RIGHT -> deltaX = 5;
// case LEFT -> deltaX = -5;
// case UP -> deltaY = -5;
// case DOWN -> deltaY = 5;
// }
// ball.setCenterX(ball.getTranslateX() + ball.getCenterX() + deltaX);
// ball.setCenterY(ball.getTranslateY() + ball.getCenterY() + deltaY);
// catchEnemy(ball, apples, canvas);
// }
// );
stage.setScene(scene);
stage.show();
stage.setTitle("PackMan minimal");
}
private List<Circle> generateApples() {
List<Circle> apples = new ArrayList<>();
Random rn = new Random();
for (int i = 0; i < 10; i++) {
Circle apple = new Circle(10, Color.GREEN);
apple.relocate(rn.nextInt(500), rn.nextInt(500));
apples.add(apple);
}
return apples;
}
private Group buildMarkO(double x, double y, int size) {
Group group = new Group();
int radius = size / 2;
Circle circle = new Circle(x + radius, y + radius, radius - 10);
circle.setStroke(Color.BLACK);
circle.setFill(Color.WHITE);
group.getChildren().add(circle);
return group;
}
public FindIcon(double size)
{
super(size);
double r = 0.3 * size;
double w = 0.075 * size;
double gap = 0.12 * size;
double handle = 0.15 * size;
Circle c = new Circle(0, 0, r);
c.setFill(null);
c.setStrokeWidth(w);
c.setStroke(Color.BLACK);
c.setFill(null);
FxPath p = new FxPath();
p.setStrokeLineCap(StrokeLineCap.SQUARE);
p.setStroke(Color.BLACK);
p.setStrokeWidth(w);
p.moveto(r, 0);
p.lineto(r + gap, 0);
FxPath h = new FxPath();
h.setStrokeLineCap(StrokeLineCap.ROUND);
h.setStroke(Color.BLACK);
h.setStrokeWidth(w * 2);
h.moveto(r + gap, 0);
h.lineto(r + gap + handle, 0);
Group g = new Group(c, p, h);
g.setRotate(135);
g.setTranslateX(size * 0.30);
g.setTranslateY(size * 0.54);
add(g);
}