# HG changeset patch # User one # Date 1359192634 -32400 # Node ID 611b5be7f58ce9513b7a92517c39628ff6f1e2eb # Parent b997f2ce1a04ea20318f9b1049e8c831438538be add JavaFx main class diff -r b997f2ce1a04 -r 611b5be7f58c src/alice/test/topology/aquarium/fx/Aquarium.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/alice/test/topology/aquarium/fx/Aquarium.java Sat Jan 26 18:30:34 2013 +0900 @@ -0,0 +1,62 @@ +package alice.test.topology.aquarium.fx; + +import java.io.IOException; + +import example.AddObject; +import example.SetTranslation; + +import javafx.application.Application; +import javafx.collections.ObservableList; +import javafx.event.EventHandler; +import javafx.fxml.FXMLLoader; +import javafx.scene.Node; +import javafx.scene.Scene; +import javafx.scene.image.Image; +import javafx.scene.image.ImageView; +import javafx.scene.layout.AnchorPane; +import javafx.stage.Stage; +import javafx.stage.WindowEvent; + +public class Aquarium extends Application { + + private ObservableList list; + + @Override + public void start(Stage primaryStage) throws IOException { + FXMLLoader loader = new FXMLLoader(); + AnchorPane root = loader.load(getClass().getResource("aquarium.fxml")); + // AquariumController cont = (AquariumController) loader.getController(); get Controller instance + System.out.println(root.getChildren().get(1).getId()); + ImageView iv = (ImageView) root.getChildren().get(3); + Image img = new Image("fish.jpg"); + iv.setImage(img); + list = root.getChildren(); + System.out.println(list.toString()); + new SetTranslation(iv, "image1"); + Scene scene = new Scene(root); + + primaryStage.setScene(scene); + primaryStage.setResizable(false); + primaryStage.show(); + primaryStage.setOnCloseRequest(new EventHandler(){ + public void handle(WindowEvent we) { + System.exit(0); + } + }); + new AddObject(this); + + } + + public static void main(String[] args) { + launch(args); + } + + public void run(){ + launch(); + + } + + public ObservableList getList(){ + return list; + } +}