package org.markdownwriterfx;
import java.util.prefs.Preferences;
import javafx.application.Application;
import javafx.scene.image.Image;
import javafx.stage.Stage;
import org.markdownwriterfx.options.Options;
import org.markdownwriterfx.util.StageState;
public class MarkdownWriterFXApp
extends Application
{
private static Application app;
private MainWindow mainWindow;
@SuppressWarnings("unused")
private StageState stageState;
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage primaryStage) throws Exception {
app = this;
Options.load(getOptions());
mainWindow = new MainWindow();
stageState = new StageState(primaryStage, getState());
primaryStage.getIcons().addAll(
new Image("org/markdownwriterfx/markdownwriterfx16.png"),
new Image("org/markdownwriterfx/markdownwriterfx32.png"),
new Image("org/markdownwriterfx/markdownwriterfx128.png"),
new Image("org/markdownwriterfx/markdownwriterfx256.png"),
new Image("org/markdownwriterfx/markdownwriterfx512.png"));
primaryStage.setTitle("Markdown Writer FX");
primaryStage.setScene(mainWindow.getScene());
primaryStage.show();
}
public static void showDocument(String uri) {
app.getHostServices().showDocument(uri);
}
static private Preferences getPrefsRoot() {
return Preferences.userRoot().node("markdownwriterfx");
}
static Preferences getOptions() {
return getPrefsRoot().node("options");
}
public static Preferences getState() {
return getPrefsRoot().node("state");
}
}