mirror of
https://github.com/klmp200/sarl-fireworks.git
synced 2024-11-21 22:33:20 +00:00
Converting FX application from Java into SARL
This commit is contained in:
parent
01b4d82989
commit
6b02ee3c85
@ -1,41 +0,0 @@
|
||||
package io.sarl.demos.fireworks;
|
||||
|
||||
import java.net.URL;
|
||||
|
||||
import io.sarl.demos.fireworks.gui.FXMLViewerController;
|
||||
import javafx.application.Application;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.fxml.JavaFXBuilderFactory;
|
||||
import javafx.scene.Parent;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
public class FireworksFXApplication extends Application {
|
||||
|
||||
private FXMLLoader loader;
|
||||
|
||||
@Override
|
||||
public void start(Stage stage) throws Exception {
|
||||
URL location = getClass().getResource("FireworksFXApplication.fxml");
|
||||
loader = new FXMLLoader();
|
||||
loader.setLocation(location);
|
||||
loader.setBuilderFactory(new JavaFXBuilderFactory());
|
||||
Parent root = (Parent) loader.load(location.openStream());
|
||||
Scene scene = new Scene(root);
|
||||
stage.setTitle("Firewoks sarl animation");
|
||||
stage.setScene(scene);
|
||||
stage.show();
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
launch(args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop() throws Exception {
|
||||
// TODO Auto-generated method stub
|
||||
super.stop();
|
||||
((FXMLViewerController) loader.getController()).cleanExit();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package io.sarl.demos.fireworks
|
||||
|
||||
import io.sarl.demos.fireworks.gui.FXMLViewerController
|
||||
import java.net.URL
|
||||
import javafx.application.Application
|
||||
import javafx.fxml.FXMLLoader
|
||||
import javafx.fxml.JavaFXBuilderFactory
|
||||
import javafx.scene.Parent
|
||||
import javafx.scene.Scene
|
||||
import javafx.stage.Stage
|
||||
|
||||
class FireworksFXApplication extends Application {
|
||||
|
||||
private var loader : FXMLLoader
|
||||
|
||||
@Override
|
||||
public def start(stage: Stage) throws Exception {
|
||||
var location : URL = getClass().getResource("FireworksFXApplication.fxml");
|
||||
loader = new FXMLLoader();
|
||||
loader.setLocation(location);
|
||||
loader.setBuilderFactory(new JavaFXBuilderFactory());
|
||||
var root : Parent = loader.load(location.openStream()) as Parent;
|
||||
var scene : Scene = new Scene(root);
|
||||
stage.setTitle("Firewoks sarl animation");
|
||||
stage.setScene(scene);
|
||||
stage.show();
|
||||
}
|
||||
|
||||
public static def main(args: String[]) {
|
||||
launch(args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public def stop() throws Exception {
|
||||
super.stop();
|
||||
(loader.getController() as FXMLViewerController).cleanExit();
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user