import org.fxmisc.cssfx.CSSFX; //导入依赖的package包/类
@Override
public void start(Stage primaryStage) {
HostServiceSingleton.setInstance(getHostServices()); //weigl: ???
this.mainScene = new StvsMainScene();
this.primaryStage = new Stage();
Platform.setImplicitExit(true);
primaryStage.setTitle(StvsVersion.getWindowTitle());
primaryStage.setScene(mainScene.getScene());
primaryStage.setMaximized(mainScene.shouldBeMaximizedProperty().get());
primaryStage.getIcons().addAll(
new Image(StvsApplication.class.getResourceAsStream("logo_large.png")),
new Image(StvsApplication.class.getResourceAsStream("logo.png")));
mainScene.shouldBeMaximizedProperty().bind(primaryStage.maximizedProperty());
mainScene.getScene().getStylesheets().add(
StvsApplication.class.getResource("normal.css").toExternalForm()
);
CSSFX.start(mainScene.getScene());
//Debugger snippet for finding the styleclasses for the node under cursor.
mainScene.getScene().addEventFilter(MouseEvent.MOUSE_MOVED, mouseEvent -> {
if (mouseEvent.isAltDown() && mouseEvent.isControlDown()) {
try {
Node node = (Node) mouseEvent.getTarget();
ObservableList classes = node.getStyleClass();
System.out.println("Classes of " + node.getClass().getSimpleName() + " are " + classes);
System.out.println("Style of " + node.getClass().getSimpleName() + ": " + node.getStyle());
System.out.println(((TitledPane) node).getAlignment());
System.out.println(((TitledPane) node).getTextAlignment());
} catch (ClassCastException e) {
}
}
});
if (System.getProperty("presentation", "false").equals("true")) {
mainScene.getScene().getStylesheets().add(
StvsApplication.class.getResource("presentation.css").toExternalForm()
);
}
if (mainScene.getRootController().getRootModel().isFirstStart()) {
new WelcomeWizard(mainScene.getRootController().getRootModel().getGlobalConfig())
.showAndWait();
}
primaryStage.show();
}