Question: LISTING 14.19 ShowPolygon.java 1 import javax application Application: 2 sport javax.collections Observablelist: mport javax.scene Scene #mport javax scene layout Pane 5 sport java.scene paint.Color import
LISTING 14.19 ShowPolygon.java 1 import javax application Application: 2 sport javax.collections Observablelist: mport javax.scene Scene #mport javax scene layout Pane 5 sport java.scene paint.Color import javax. stage. Stage 1 Import javax.scene shape. Polygon puble class ShowPolygon extends Application 10 Override over the start method in the Applications public void start (Stage primarystage) 12 Il create scene place in the stage 13 Scane scene new Scene new MyPolygont). 100.400) 14 primarystage settle helpoll set the stage title 15 primaryStage. set Scene cene): Place the scene in the stage 16 primary stage show(): Display the stage 17 18) 19 20 clase MyPolygon extends Pare 21 private void paint() 22 Create polyplace polygon to pene 23 Polygon polypon new Polygon() 25 polygon, sotstroke (Color BLACK) 20 ObservableListDouble et polypongetotna) 27 28 double centarx getwidth center - getight 29 double radius Nathan (get) geheight: 30 31 Au points to the polypon at 32 33 for (int 10:1510) Tistad (center radius. Math.cos 34 11.add(centery - radius Math in Math 1) 35 36 37 getChildren().clear() 38 getchildren), odpolygon) 39 40 41 Override 42 bile voldoende ble with 43 super seithwidth): paint: 46 Override 48 Dublic void setteont (double meight) 49 super steight (night) 50 paint 51 52) 7. Task 2 Update the program in Task 1 to display a polyline as shown in the figure below. ShowPolygon fox
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
