javafx drawing

Solutions on MaxInterview for javafx drawing by the best coders in the world

showing results for - "javafx drawing"
Louisa
04 Mar 2016
1import javafx.application.Application; 
2import javafx.scene.Group; 
3import javafx.scene.Scene; 
4import javafx.stage.Stage; 
5import javafx.scene.shape.LineTo; 
6import javafx.scene.shape.MoveTo; 
7import javafx.scene.shape.Path; 
8         
9public class ComplexShape extends Application { 
10   @Override 
11   public void start(Stage stage) { 
12      //Creating a Path 
13      Path path = new Path(); 
14       
15      //Moving to the starting point 
16      MoveTo moveTo = new MoveTo(108, 71); 
17        
18      //Creating 1st line 
19      LineTo line1 = new LineTo(321, 161);  
20       
21      //Creating 2nd line 
22      LineTo line2 = new LineTo(126,232);       
23       
24      //Creating 3rd line 
25      LineTo line3 = new LineTo(232,52);  
26       
27      //Creating 4th line 
28      LineTo line4 = new LineTo(269, 250);   
29       
30      //Creating 4th line 
31      LineTo line5 = new LineTo(108, 71);  
32       
33      //Adding all the elements to the path 
34      path.getElements().add(moveTo); 
35      path.getElements().addAll(line1, line2, line3, line4, line5);        
36         
37      //Creating a Group object  
38      Group root = new Group(path); 
39         
40      //Creating a scene object 
41      Scene scene = new Scene(root, 600, 300);  
42      
43      //Setting title to the Stage 
44      stage.setTitle("Drawing an arc through a path");
45      
46      //Adding scene to the stage 
47      stage.setScene(scene);
48      
49      //Displaying the contents of the stage 
50      stage.show();         
51   } 
52   public static void main(String args[]){ 
53      launch(args); 
54   } 
55}       
queries leading to this page
javafx drawing applicationjavafx drawing