Java Code Examples for javafx.scene.control.ButtonType#CLOSE

The following examples show how to use javafx.scene.control.ButtonType#CLOSE . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AboutDialog.java    From BlockMap with MIT License 6 votes vote down vote up
public AboutDialog() throws IOException {
	super(AlertType.NONE, null, ButtonType.CLOSE);
	setTitle("About BlockMap");
	setResizable(true);
	initModality(Modality.APPLICATION_MODAL);

	FXMLLoader loader = new FXMLLoader(getClass().getResource("aboutpane.fxml"));
	loader.setController(this);
	getDialogPane().setContent(loader.load());
	getDialogPane().getStylesheets().add("/de/piegames/blockmap/gui/standalone/about/style.css");

	aboutTitle.setText("BlockMap " + VersionProvider.VERSION);

	@SuppressWarnings("serial")
	List<Dependency> dependencies = new GsonBuilder().registerTypeAdapterFactory(new GsonJava8TypeAdapterFactory()).create().fromJson(
			// TODO automate copying that file on dependency change
			new InputStreamReader(getClass().getResourceAsStream("licenseReport.json")),
			new TypeToken<List<Dependency>>() {
			}.getType());

	for (Dependency dependency : dependencies) {
		this.dependencies.getChildren().add(new DependencyPane(dependency));
	}

	license.setText(LICENSE_TEXT);
}
 
Example 2
Source File: NewItemDialog.java    From tcMenu with Apache License 2.0 6 votes vote down vote up
public NewItemDialog(Stage stage, MenuTree tree, CurrentProjectEditorUI editorUI, boolean modal) {
    try {
        FXMLLoader loader = new FXMLLoader(NewItemDialog.class.getResource("/ui/newItemDialog.fxml"));
        BorderPane pane = loader.load();
        controller = loader.getController();
        controller.initialise(new MenuIdChooserImpl(tree), editorUI);

        createDialogStateAndShow(stage, pane, "Create new item", modal);

    }
    catch(Exception e) {
        Alert alert = new Alert(Alert.AlertType.ERROR, "Error creating form", ButtonType.CLOSE);
        alert.setHeaderText("Error creating the form, more detail is in the log");
        alert.showAndWait();

        logger.log(ERROR, "Unable to create the form", e);
    }
}
 
Example 3
Source File: AboutDialog.java    From tcMenu with Apache License 2.0 6 votes vote down vote up
public AboutDialog(ConfigurationStorage storage, Stage stage, ArduinoLibraryInstaller installer, boolean modal) {
    try {
        FXMLLoader loader = new FXMLLoader(NewItemDialog.class.getResource("/ui/aboutDialog.fxml"));
        BorderPane pane = loader.load();
        controller = loader.getController();
        controller.initialise(storage, installer);


        createDialogStateAndShow(stage, pane, "About tcMenu Designer", modal);
    }
    catch(Exception e) {
        Alert alert = new Alert(Alert.AlertType.ERROR, "Error creating form", ButtonType.CLOSE);
        alert.setHeaderText("Error creating the form, more detail is in the log");
        alert.showAndWait();

        logger.log(ERROR, "Unable to create the form", e);
    }
}
 
Example 4
Source File: RomLayoutDialog.java    From tcMenu with Apache License 2.0 6 votes vote down vote up
public RomLayoutDialog(Stage stage, MenuTree menuTree, boolean modal) {
    try {
        FXMLLoader loader = new FXMLLoader(NewItemDialog.class.getResource("/ui/romLayoutDialog.fxml"));
        BorderPane pane = loader.load();
        RomLayoutController controller = loader.getController();
        controller.init(menuTree);

        createDialogStateAndShow(stage, pane, "Rom Layout", modal);
    } catch (IOException e) {
        Alert alert = new Alert(Alert.AlertType.ERROR, "Error creating form", ButtonType.CLOSE);
        alert.setHeaderText("Error creating the form, more detail is in the log");
        alert.showAndWait();

        logger.log(ERROR, "Unable to create the form", e);
    }
}
 
Example 5
Source File: MenuEditorApp.java    From tcMenu with Apache License 2.0 6 votes vote down vote up
private void createDirsIfNeeded() {
    var homeDir = Paths.get(System.getProperty("user.home"));
    try {
        Path menuDir = homeDir.resolve(".tcmenu/logs");
        if(!Files.exists(menuDir)) {
            Files.createDirectories(menuDir);
        }
        Path pluginDir = homeDir.resolve(".tcmenu/plugins");
        if(!Files.exists(pluginDir)) {
            Files.createDirectories(pluginDir);
        }
    } catch (IOException e) {
        Alert alert = new Alert(AlertType.ERROR, "Error creating user directory", ButtonType.CLOSE);
        alert.setContentText("Couldn't create user directory: " + e.getMessage());
        alert.showAndWait();
    }
}