Advertisement
LG18

Shapes

May 30th, 2021
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.32 KB | None | 0 0
  1. public class Shapes extends Application implements EventHandler<ActionEvent> {
  2.    
  3.    
  4.  
  5.     public static void main(String[] args) {
  6.         Application.launch(args);
  7.        
  8.        
  9.  
  10.     }
  11.  
  12.  
  13.     @Override
  14.     public void start(Stage stage)
  15.     {
  16.        
  17.        
  18.        
  19.        
  20.     TextField T1 = new TextField();
  21.     TextField T2 = new TextField();
  22.  
  23.    
  24.        
  25.         HBox H1 = new HBox(T1);
  26.         H1.setLayoutX(150);
  27.         H1.setLayoutY(300);
  28.         H1.setMaxWidth(75);
  29.        
  30.         HBox H2 = new HBox(T2);
  31.         H2.setLayoutX(262);
  32.         H2.setLayoutY(300);
  33.         H2.setMaxWidth(75);
  34.    
  35.        
  36.         Button BM = new Button();
  37.         BM.setText("GENERATE SHAPE");
  38.         BM.setLayoutX(190);
  39.         BM.setLayoutY(350);
  40.        
  41.         Text caption1 = new Text(50, 50, "ENTER SHAPE");
  42.         caption1.setLayoutX(101);
  43.         caption1.setLayoutY(245);
  44.        
  45.         Text caption2 = new Text(100, 100, "ENTER COLOUR");
  46.         caption2.setLayoutX(156.5);
  47.         caption2.setLayoutY(195.4);
  48.        
  49.         Text Header = new Text ("SHAPE GENERATOR");
  50.         Header.setTextAlignment(TextAlignment.CENTER);
  51.         Header.setLayoutY(50);
  52.         Header.setLayoutX(146);
  53.         Header.setFont(Font.font("Verdana", 20));
  54.         Header.setFill(Color.DARKCYAN);
  55.        
  56.         Text Instruction = new Text("Once you choose your shape and shape colour, press \"GENERATE SHAPE\" to create your shape");
  57.         Instruction.setTextAlignment(TextAlignment.CENTER);
  58.         Instruction.setLayoutY(70);
  59.         Instruction.setLayoutX(1.5);
  60.         Instruction.setFont(Font.font("Verdana", 10));
  61.        
  62.        
  63.         Rectangle R = new Rectangle(50,50,50,100);
  64.         R.setStroke(Color.BLACK);
  65.        
  66.         Circle C = new Circle(50, 50, 80);
  67.         C.setStroke(Color.BLACK);
  68.    
  69.         Arc A = new Arc (125, 100, 100, 100, 90, 50);
  70.         A.setStroke(Color.BLACK);
  71.         A.setType(ArcType.CHORD);
  72.        
  73.         VBox V1 = new VBox();
  74.         V1.setLayoutX(242);
  75.         V1.setLayoutY(170);
  76.         V1.setScaleX(24);
  77.         V1.setScaleY(24);
  78.         BorderStroke stroke1 = new BorderStroke(Color.BLACK, BorderStrokeStyle.SOLID, new CornerRadii(0), new BorderWidths(4));
  79.         V1.setBorder(new Border(stroke1));
  80.        
  81.         //BM.setOnAction
  82.        
  83.    
  84.        
  85.         Group root = new Group(H1, H2, caption1, caption2, BM, Header, Instruction);
  86.         Scene scene = new Scene(root, Color.LIGHTGREY);
  87.        
  88.         stage.setTitle ("Shapes");
  89.         stage.setScene(scene);
  90.         stage.show();
  91.         stage.setWidth(500);
  92.         stage.setHeight(500);
  93.         stage.setResizable(false);
  94.        
  95.        
  96.    
  97.     }
  98.  
  99.  
  100.     @Override
  101.     public void handle(ActionEvent event)
  102.     {
  103.        
  104.        
  105.        
  106.        
  107.        
  108.     }
  109.  
  110.  
  111.  
  112. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement