Java Reference
In-Depth Information
Ellipse smallCircle = new Ellipse(100, 100, 35/2, 25/
2);
// make a donut
Shape donut = Path.subtract(bigCircle, smallCircle);
donut.setStrokeWidth(1);
donut.setStroke(Color.BLACK);
// orange glaze
donut.setFill(Color.rgb(255, 200, 0));
// add drop shadow
DropShadow dropShadow = new DropShadow();
dropShadow.setOffsetX(2.0f);
dropShadow.setOffsetY(2.0f);
dropShadow.setColor(Color.rgb(50, 50, 50, .588));
donut.setEffect(dropShadow);
// move slightly down for spacing
donut.setTranslateY(quad.getBoundsInParent().getMinY()
+ 10);
root.getChildren().add(donut);
primaryStage.setScene(scene);
primaryStage.show();
}
Figure 14-5 displays the sine wave, ice cream cone, smile, and donut shapes cre-
ated using JavaFX.
 
Search WWH ::




Custom Search