//'main' method must be in a class 'Rextester'. //Compiler version 1.8.0_111 package Graphics; import javafx.application.Application; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.input.KeyCode; import javafx.scene.paint.Color; import javafx.scene.shape.Polygon; import javafx.scene.shape.Rectangle; import javafx.scene.transform.Rotate; import javafx.scene.transform.Scale; import javafx.stage.Stage; import java.util.Random; public class Second extends Application { private final double[] trianglePoints = new double[] {650, 70, 750, 220, 550, 220}; private final double x = 250, y = 100, width = 100, height = 100; private final double moveX = 10, moveY = 20; private final double theta = 135; launch(args); } @Override public void start(Stage window) { rectangle.setFill(rectColor); triangle.setFill(getColor(random)); group.getChildren().addAll(rectangle, triangle); scene.setOnKeyPressed(e -> { if (e.getCode() == KeyCode.C) { rectangle.setFill(getColor(random)); triangle.setFill(getColor(random)); } else if (e.getCode() == KeyCode.DIGIT1) { Rotate rectRotate = new Rotate(); rectRotate.setAngle(theta); rectRotate.setPivotX(rectangle.getX() + rectangle.getWidth() / 2); rectRotate.setPivotY(rectangle.getY() + rectangle.getHeight() / 2); rectangle.getTransforms().add(rectRotate); rectangle.setFill(triangle.getFill()); } else if (e.getCode() == KeyCode.DIGIT2) { Scale rectScale = new Scale(); rectScale.setX(2); rectScale.setY(2); rectScale.setPivotX(rectangle.getX() + rectangle.getWidth() / 2); rectScale.setPivotY(rectangle.getY() + rectangle.getHeight() / 2); rectangle.getTransforms().add(rectScale); rectangle.setFill(triangle.getFill()); } else if (e.getCode() == KeyCode.DIGIT3) { rectangle.setX(rectangle.getX() + moveX); rectangle.setY(rectangle.getY() + moveY); rectangle.setFill(triangle.getFill()); } else if (e.getCode() == KeyCode.SPACE) { rectangle.getTransforms().clear(); rectangle.setX(x); rectangle.setY(y); rectangle.setFill(rectColor); } }); window.setTitle("Labrador 2"); window.setScene(scene); window.show(); } } }
Standard input is empty
Main.java:20: error: class Second is public, should be declared in a file named Second.java
public class Second extends Application {
^
Main.java:6: error: package javafx.application does not exist
import javafx.application.Application;
^
Main.java:7: error: package javafx.scene does not exist
import javafx.scene.Group;
^
Main.java:8: error: package javafx.scene does not exist
import javafx.scene.Scene;
^
Main.java:9: error: package javafx.scene.input does not exist
import javafx.scene.input.KeyCode;
^
Main.java:10: error: package javafx.scene.paint does not exist
import javafx.scene.paint.Color;
^
Main.java:11: error: package javafx.scene.shape does not exist
import javafx.scene.shape.Polygon;
^
Main.java:12: error: package javafx.scene.shape does not exist
import javafx.scene.shape.Rectangle;
^
Main.java:13: error: package javafx.scene.transform does not exist
import javafx.scene.transform.Rotate;
^
Main.java:14: error: package javafx.scene.transform does not exist
import javafx.scene.transform.Scale;
^
Main.java:15: error: package javafx.stage does not exist
import javafx.stage.Stage;
^
Main.java:20: error: cannot find symbol
public class Second extends Application {
^
symbol: class Application
Main.java:32: error: cannot find symbol
public void start(Stage window) {
^
symbol: class Stage
location: class Second
Main.java:96: error: cannot find symbol
public Color getColor(Random r) {
^
symbol: class Color
location: class Second
Main.java:28: error: cannot find symbol
launch(args);
^
symbol: method launch(String[])
location: class Second
Main.java:31: error: method does not override or implement a method from a supertype
@Override
^
Main.java:35: error: cannot find symbol
Group group = new Group();
^
symbol: class Group
location: class Second
Main.java:35: error: cannot find symbol
Group group = new Group();
^
symbol: class Group
location: class Second
Main.java:37: error: cannot find symbol
Rectangle rectangle = new Rectangle(x, y, width, height);
^
symbol: class Rectangle
location: class Second
Main.java:37: error: cannot find symbol
Rectangle rectangle = new Rectangle(x, y, width, height);
^
symbol: class Rectangle
location: class Second
Main.java:38: error: cannot find symbol
Polygon triangle = new Polygon(trianglePoints);
^
symbol: class Polygon
location: class Second
Main.java:38: error: cannot find symbol
Polygon triangle = new Polygon(trianglePoints);
^
symbol: class Polygon
location: class Second
Main.java:39: error: cannot find symbol
Color rectColor = getColor(random);
^
symbol: class Color
location: class Second
Main.java:45: error: cannot find symbol
Scene scene = new Scene(group, 1000, 400, Color.LIGHTGRAY);
^
symbol: class Scene
location: class Second
Main.java:45: error: cannot find symbol
Scene scene = new Scene(group, 1000, 400, Color.LIGHTGRAY);
^
symbol: class Scene
location: class Second
Main.java:45: error: cannot find symbol
Scene scene = new Scene(group, 1000, 400, Color.LIGHTGRAY);
^
symbol: variable Color
location: class Second
Main.java:48: error: cannot find symbol
if (e.getCode() == KeyCode.C) {
^
symbol: variable KeyCode
location: class Second
Main.java:53: error: cannot find symbol
} else if (e.getCode() == KeyCode.DIGIT1) {
^
symbol: variable KeyCode
location: class Second
Main.java:54: error: cannot find symbol
Rotate rectRotate = new Rotate();
^
symbol: class Rotate
location: class Second
Main.java:54: error: cannot find symbol
Rotate rectRotate = new Rotate();
^
symbol: class Rotate
location: class Second
Main.java:63: error: cannot find symbol
} else if (e.getCode() == KeyCode.DIGIT2) {
^
symbol: variable KeyCode
location: class Second
Main.java:64: error: cannot find symbol
Scale rectScale = new Scale();
^
symbol: class Scale
location: class Second
Main.java:64: error: cannot find symbol
Scale rectScale = new Scale();
^
symbol: class Scale
location: class Second
Main.java:74: error: cannot find symbol
} else if (e.getCode() == KeyCode.DIGIT3) {
^
symbol: variable KeyCode
location: class Second
Main.java:81: error: cannot find symbol
} else if (e.getCode() == KeyCode.SPACE) {
^
symbol: variable KeyCode
location: class Second
Main.java:97: error: cannot find symbol
return Color.color(r.nextDouble(), r.nextDouble(), r.nextDouble());
^
symbol: variable Color
location: class Second
36 errors
Standard output is empty