import javafx.application.Application; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.canvas.Canvas; import javafx.scene.canvas.GraphicsContext; import javafx.scene.paint.Color; import javafx.scene.shape.ArcType; import javafx.stage.Stage; public class Joonis2 extends Application { public static void main(String[] args) { launch(args); } @Override public void start(Stage stage) { stage.setTitle("Joonistusaken"); Group root = new Group(); Canvas canvas = new Canvas(300, 250); GraphicsContext gc = canvas.getGraphicsContext2D(); drawShapes(gc); root.getChildren().add(canvas); stage.setScene(new Scene(root)); stage.show(); } Takisti1 t=new Takisti1(10, 30, 80, 30); Takisti1 t2=new Takisti1(110, 30, 110, 130); private void drawShapes(GraphicsContext gc) { t.joonista(gc); t2.joonista(gc); } }