下面列出了javafx.scene.control.ButtonType#CLOSE 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
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);
}
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);
}
}
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);
}
}
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);
}
}
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();
}
}