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.stage.Stage; public class PaiknemisJoonis1 extends Application { public static void main(String[] args) { launch(args); } public void joonista(Paiknev p, GraphicsContext gc){ gc.fillText(p.getClass().getName(), p.x()*10, p.y()*10); } @Override public void start(Stage stage) { stage.setTitle("Joonistusaken"); Group root = new Group(); Canvas canvas = new Canvas(300, 250); GraphicsContext gc = canvas.getGraphicsContext2D(); root.getChildren().add(canvas); stage.setScene(new Scene(root)); stage.show(); Kapp raamatukapp=new Kapp(0, 5, 200); joonista(raamatukapp, gc); //Lisage ka teine kapp ja kirbud joonisele } }