Question: I am trying to run my Java program in eclipse but it wopackage Shapes; / / imported the required packages import javafx.application.Application; import javafx.geometry.Insets; import

I am trying to run my Java program in eclipse but it wopackage Shapes;
//imported the required packages
import javafx.application.Application;
import javafx.geometry.Insets;
import javafx.scene.Scene;
import javafx.scene.Group;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.StackPane;
import javafx.scene.shape.Line;
import javafx.scene.shape.Circle;
import javafx.scene.shape.Rectangle;
import javafx.scene.paint.Color;
import javafx.stage.Stage;
//
public class Shape extends Application {
//defining the X variable
private static final int x =50;
public static void launch(String[] args){
launch(args);
}
@Override
public void start(Stage primaryStage)
throws Exception {
//created rectangle
//set properties
Rectangle rect = new Rectangle();
rect.setX(50);
rect.setY(50);
rect.setHeight(2* x);
rect.setWidth(2* x);
rect.setStroke(Color.BLUE);
rect.setFill(Color.BLUE);
rect.setStrokeWidth(3);
//created circle
//set properties
Circle c = new Circle(x);
c.setStroke(Color.RED);
c.setFill(Color.RED);
c.setStrokeWidth(3);
Line line11= new Line(-x /1.5,-x /2.5, x /1.5,-x /2.5);
Line line12= new Line(0,-x,0, x);
line11.setStroke(Color.GREEN);
line11.setStrokeWidth(6);
line12.setStroke(Color.GREEN);
line12.setStrokeWidth(6);
StackPane lines = new StackPane();
GridPane pane = new GridPane();
pane.setPadding(new Insets(10,10,10,10));
pane.add(lines,2,2);
pane.add(rect,0,0);
pane.add(c,1,1);
pane.add(new Group(),2,2);
Scene scene = new Scene(pane);
primaryStage.setTitle("Shapes in Grid");
primaryStage.setScene(scene);
primaryStage.show();
primaryStage.setResizable(false);
}
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!