i have this code but its not working can you help me fix and

i have this code but it\'s not working can you help me fix and a include a string on top? thank you and explain why it wasnt working

// Applet that displays a simple logo on the screen


import java.awt.Canvas;

import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.canvas.GraphicsContext;
import javafx.scene.paint.Color;
import javafx.scene.shape.Circle;
import javafx.stage.Stage;

import javafx.geometry.Insets;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.layout.*;


public class lab extends Application{
@Override

     
  

     
public void start (Stage primaryStage)
{
     
   Group root = new Group();
   final Canvas canvas = new Canvas (285,340);
   GraphicsContext gc =canvas.getGraphicsContext2D();
   gc.setFill(Color.WHITESMOKE);
   gc.fillRect(gc.getCanvas().getLayoutX(),gc.getCanvas().getLayoutY(),
           gc.getCanvas().getWidth(), gc.getCanvas().getHeight());
   gc.setFill(Color.GREEN);
   gc.setStroke(Color.BLUE);
   gc.setLineWidth(5);
   gc.strokeLine(40,10,10,40);
   gc.fillOval(10,60,30,30);
   gc.strokeOval(60,60,30,30);
     
  
     
   root.getChildren().addAll(canvas);
   primaryStage.setScene(new Scene(root));
   primaryStage.getScene().setFill(Color.AQUA);
   primaryStage.show();
     

}
public static void main(String[] args)
{
   launch(args);
   }
}

Solution

hope this helps you:

i have this code but it\'s not working can you help me fix and a include a string on top? thank you and explain why it wasnt working // Applet that displays a s
i have this code but it\'s not working can you help me fix and a include a string on top? thank you and explain why it wasnt working // Applet that displays a s

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site