view src/alice/test/topology/aquarium/fx/Aquarium.java @ 3:4930f8daf49d

add object register CS
author one
date Sat, 26 Jan 2013 20:34:13 +0900
parents 611b5be7f58c
children 50d77513d52e
line wrap: on
line source

package alice.test.topology.aquarium.fx;

import java.io.IOException;

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<Node> 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);
        
        new AddObject(this);
        
        primaryStage.setScene(scene);
        primaryStage.setResizable(false);
        primaryStage.show();
        primaryStage.setOnCloseRequest(new EventHandler<WindowEvent>(){
        	public void handle(WindowEvent we) {
            	System.exit(0);
            }
        });
	}

	public static void main(String[] args) {
		launch(args);
	}
	
	public void run(){
		launch();
		
	}
	
	public ObservableList<Node> getList(){
		return list;
	}
}