Skip to main content
summaryrefslogtreecommitdiffstats
blob: 46636ed6e2b9a950694a2f1cf5b0686d04a8b7ab (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package org.eclipse.fx.demo.osgi.di;

import java.io.IOException;

import javafx.scene.Scene;
import javafx.scene.layout.BorderPane;
import javafx.stage.Stage;

import javax.annotation.PostConstruct;
import javax.inject.Inject;

import org.eclipse.equinox.app.IApplicationContext;
import org.eclipse.fx.ui.di.FXMLBuilder;
import org.eclipse.fx.ui.di.FXMLLoader;
import org.eclipse.fx.ui.di.FXMLLoaderFactory;

public class MainApplication {
	@Inject
	@FXMLLoader
	FXMLLoaderFactory loaderFactory;
	
	@PostConstruct
	void run(IApplicationContext applicationContext, javafx.application.Application jfxApplication, Stage primaryStage) {
		FXMLBuilder<BorderPane> loader = loaderFactory.loadRequestorRelative("ExampleGraph.fxml");
		try {
			BorderPane pane = loader.load();
			Scene s = new Scene(pane, 200, 200);
			primaryStage.setScene(s);
			primaryStage.show();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}

Back to the top