2017-05-12 14:39:13 +00:00
|
|
|
package io.sarl.demos.sierpinski
|
|
|
|
|
2017-06-13 08:22:42 +00:00
|
|
|
import io.sarl.demos.sierpinski.gui.FXMLViewerController
|
|
|
|
import java.net.URL
|
|
|
|
import java.util.ResourceBundle
|
2017-05-12 14:39:13 +00:00
|
|
|
import javafx.application.Application
|
|
|
|
import javafx.fxml.FXMLLoader
|
|
|
|
import javafx.fxml.JavaFXBuilderFactory
|
|
|
|
import javafx.scene.Parent
|
|
|
|
import javafx.scene.Scene
|
2017-06-13 08:22:42 +00:00
|
|
|
import javafx.stage.Stage
|
2017-05-12 14:39:13 +00:00
|
|
|
|
2017-06-13 13:19:14 +00:00
|
|
|
/*
|
|
|
|
* Sierpinski fractal demo
|
|
|
|
*/
|
2017-05-12 14:39:13 +00:00
|
|
|
class FractalesFXApplications extends Application {
|
2017-06-13 08:22:42 +00:00
|
|
|
private var loader : FXMLLoader
|
|
|
|
|
|
|
|
private val bundle : ResourceBundle = ResourceBundle.getBundle(
|
|
|
|
FractalesFXApplications.getPackage.name.replaceAll("\\.", "/") + "/" + FractalesFXApplications.simpleName);
|
|
|
|
|
2017-05-12 14:39:13 +00:00
|
|
|
@Override
|
|
|
|
public def start(stage: Stage) throws Exception {
|
|
|
|
var location: URL = getClass().getResource("FractalesFXApplication.fxml")
|
|
|
|
loader = new FXMLLoader()
|
|
|
|
loader.setLocation(location)
|
|
|
|
loader.setBuilderFactory(new JavaFXBuilderFactory)
|
2017-06-13 08:22:42 +00:00
|
|
|
loader.resources = bundle
|
2017-05-12 14:39:13 +00:00
|
|
|
var root: Parent = loader.load(location.openStream) as Parent
|
|
|
|
var scene: Scene = new Scene(root)
|
2017-05-26 15:56:36 +00:00
|
|
|
scene.stylesheets.add(class.getResource("ViewerController.css").toExternalForm)
|
2017-06-13 08:22:42 +00:00
|
|
|
stage.setTitle(bundle.getString("TITLE"))
|
2017-05-12 14:39:13 +00:00
|
|
|
stage.setScene(scene)
|
|
|
|
stage.show
|
|
|
|
}
|
|
|
|
|
|
|
|
public static def main(args: String[]){
|
|
|
|
launch(args)
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public def stop() throws Exception {
|
|
|
|
super.stop()
|
2017-05-26 15:50:32 +00:00
|
|
|
(loader.controller as FXMLViewerController).exitApplication()
|
2017-05-12 14:39:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|