Question: using Java please solve this problem Create a program that draws a jack-o-lantern Open the Jackolantern class. Modify the start method in the .java file

using Java please solve this problem

Create a program that draws a jack-o-lantern

Open the Jackolantern class. Modify the start method in the .java file so that it displays a reasonably nice-looking jack?o?lantern. The jack-o-lanterns expression should clearly indicate a strong emotion (fear, joy, disgust, etc.).

Script :

// Import library packages

import javafx.application.Application;

import javafx.scene.canvas.Canvas;

import javafx.scene.Scene;

import javafx.scene.Group;

import javafx.stage.Stage;

import javafx.scene.canvas.GraphicsContext;

import javafx.scene.shape.ArcType;

import javafx.event.EventHandler;

import javafx.stage.WindowEvent;

import javafx.scene.paint.Color;

import javafx.scene.text.Font;

/** class Jackolantern

*

* The important thing that we need to do in this class is finish the

* 'paint' method.

*/

public class Jackolantern extends Application

{

public static void main(String[] args)

{

// launching the JavaFx program and the start method

launch(args);

}//main

/** the "start" method, that specifies what to draw on the screen

*

* This method needs to be updated

*/

@Override

public void start(Stage primaryStage) throws Exception

{

//set up a canvas on a scene to draw something

Group root = new Group();

Scene scene = new Scene(root);

Canvas canvas = new Canvas(600, 600);

GraphicsContext gc = canvas.getGraphicsContext2D();

//==>Replace this comment with your code<==

//setup an event and a handler for the close button. this will exit the application when the window is closed

primaryStage.setOnCloseRequest(new EventHandler() {

@Override

public void handle(WindowEvent event) {

System.exit(0);

}

});

// set up the title and display the window

root.getChildren().add(canvas);

primaryStage.setTitle("CS 273 - Lab 3 - Jack-o-lantern");

primaryStage.setScene(scene);

primaryStage.show();

}//start

}//class Jackolantern

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!