... ShapeType.PATH);
38
39         displayShape(); // sets polyline's visibility to true when app loads
40      }
41
42      // handles drawingArea's onMouseClicked event
43      @FXML
44      private void drawingAreaMouseClicked(MouseEvent e) {
45         polyline.getPoints().addAll(e.getX(), e.getY());
46         polygon.getPoints().addAll(e.getX(), e.getY()); 
47
48         // if path is empty, move to first click position and close path
49         if (path.getElements().isEmpty()) {
50            path.getElements().add(new MoveTo(e.getX(), e.getY()));
51            path.getElements().add(new ClosePath());               
52         }
53         else { // insert a new path segment before the ClosePath element
54            // create an arc segment and insert it in the path
55            ArcTo arcTo = new ArcTo();    
56            arcTo.setX(e.getX());         
57            arcTo.setY(e.getY());         
58            arcTo.setRadiusX( ...

Get Java How To Program, Late Objects, 11th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.