Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I have been writing this code ( Java ) for a couple days now and it isn't running at all. The error code I keep

I have been writing this code (Java) for a couple days now and it isn't running at all. The error code I keep getting is: Error: Could not find or load main class Shapes.
Caused by: java.lang.NoClassDefFoundError: javafx/application/Application My code is this (its in a package also): //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){
//created rectangle
//set properties
Rectangle angle = new Rectangle();
angle.setX(50);
angle.setY(50);
angle.setHeight(2* x);
angle.setWidth(2* x);
angle.setStroke(Color.BLUE);
angle.setFill(Color.BLUE);
angle.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(angle,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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David Kroenke

4th Edition

0136086535, 9780136086536

More Books

Students also viewed these Databases questions

Question

A performance measure that forecasts future performance is a

Answered: 1 week ago

Question

What is the purpose of the Salary Structure Table?

Answered: 1 week ago

Question

What is the scope and use of a Job Family Table?

Answered: 1 week ago