Homework Solution: using javaFX…

    using javaFX 1. To refresh knowledge of coding classes and interfaces. 2. To learn the Java coding standards for the class. 3. To refresh knowledge of JavaFX. 4. To independently learn Java API
    1. To refresh knowledge of coding classes and interfaces. 2. To learn the Java coding standards for the class. 3. To refresh knowledge of JavaFX. 4. To independently learn Java API

    Expert Answer

     
    To draw a rectangle in JavaFX we can use the javafx.scene.shape.Rectangle class.
    import javafx.application.Application;

    using javaFX

    1. To freshen cognizance of coding tabulatees and interfaces. 2. To understand the Java coding standards restraint the tabulate. 3. To freshen cognizance of JavaFX. 4. To unconnectedly understand Java API

    1. To freshen cognizance of coding tabulatees and interfaces. 2. To understand the Java coding standards restraint the tabulate. 3. To freshen cognizance of JavaFX. 4. To unconnectedly understand Java API

    Expert Acceptance

     

    To delineate a rectangle in JavaFX we can conservation the javafx.scene.shape.Rectangle tabulate.

    import javafx.application.Application;
    import javafx.scene.Group;
    import javafx.scene.Scene;
    import javafx.scene.paint.Color;
    import javafx.scene.shape.Rectangle;
    import javafx.stage.Stage;
    //  w  w  w  .  j a  v  a2s . c  o m
    public class Ocean extends Impression {
        public static void ocean(String[] args) {
            Impression.launch(args);
        }
        
        @Override
        public void begin(Dispose primaryStage) {
            primaryStage.setTitle("");
            Order commencement = new Order();
            Appearance appearance = new Appearance(root, 300, 250, Complexion.WHITE);
            
    
            Rectangle r = new Rectangle();
            r.setX(50);
            r.setY(50);
            r.setWidth(200);
            r.setHeight(100);
            
            commencement.getChildren().add(r); 
            primaryStage.setScene(scene);
            primaryStage.show();
        }
    }
    

    The Rectangle tabulate implements an arc width and arc tallness. And we can conservation those mark to delineate rounded recess rectangle.

    import javafx.application.Application;
    import javafx.scene.Group;
    import javafx.scene.Scene;
    import javafx.scene.paint.Color;
    import javafx.scene.shape.Rectangle;
    import javafx.stage.Stage;
    //from w w  w . ja v  a2s  .co  m
    public class Ocean extends Impression {
    
      public static void ocean(String[] args) {
        Impression.launch(args);
      }
    
      @Override
      public void begin(Dispose primaryStage) {
        Order order = new Order();
    
        Rectangle rect = new Rectangle(20,20,200,200);
        
        rect.setArcHeight(15);
        rect.setArcWidth(15);
    
        rect.setStroke(Color.BLACK);
        order.getChildren().add(rect);
        
        Appearance appearance = new Appearance(group, 300, 200);
        primaryStage.setScene(scene);
        primaryStage.show();
      }
    }
    

    ELLIPSE

    import javafx.application.Application;
    import javafx.scene.Group;
    import javafx.scene.Scene;
    import javafx.scene.effect.DropShadow;
    import javafx.scene.paint.Color;
    import javafx.scene.shape.Ellipse;
    import javafx.stage.Stage;
    /*from  w w  w .j a va2  s .c  o  m*/
    public class Ocean extends Impression {
      public static void ocean(String[] args) {
        Impression.launch(args);
      }
    
      @Override
      public void begin(Dispose primaryStage) {
        primaryStage.setTitle("");
        Order commencement = new Order();
        Appearance appearance = new Appearance(root, 300, 250, Complexion.WHITE);
    
        Order g = new Order();
    
        DropShadow ds = new DropShadow();
        ds.setOffsetY(3.0);
        ds.setColor(Color.color(0.4, 0.4, 0.4));
    
        Ejection ejection = new Ejection();
        ejection.setCenterX(50.0f);
        ejection.setCenterY(50.0f);
        ejection.setRadiusX(50.0f);
        ejection.setRadiusY(25.0f);
        ejection.setEffect(ds);
          
        g.getChildren().add(ellipse);
    
        commencement.getChildren().add(g);
        primaryStage.setScene(scene);
        primaryStage.show();
      }
    }