import javafx.application.Application; import javafx.event.*; import javafx.scene.Scene; import javafx.scene.canvas.*; import javafx.scene.control.*; import javafx.scene.layout.*; import javafx.stage.Stage; public class Poomine3 extends Application implements EventHandler{ Button nupp1=new Button("Sisesta"); TextField tf1=new TextField(); Label vastus=new Label("vastuse koht"); Canvas tahvel=new Canvas(400, 200); GraphicsContext g=tahvel.getGraphicsContext2D(); public void handle(ActionEvent e){ vastus.setText(tf1.getText()); } public void start(Stage aken){ GridPane tabel=new GridPane(); tabel.add(tf1, 1, 1); tabel.add(nupp1, 2, 1); tabel.add(vastus, 1, 2, 2, 1); tabel.add(tahvel, 1, 3, 2, 1); g.fillRect(100, 150, 10, 10); Scene stseen=new Scene(tabel, 400, 300); nupp1.setOnAction(this); tf1.setOnAction(this); aken.setScene(stseen); aken.setTitle("Poomismäng"); aken.show(); } public static void main(String[] arg){ launch(arg); } }