use of jfxtras.styles.jmetro8.JMetro in project osumer by mob41.
the class AppMain method initRootLayout.
/**
* Initializes the root layout.
*/
private void initRootLayout() {
try {
// Load root layout from fxml file.
FXMLLoader loader = new FXMLLoader();
loader.setLocation(AppMain.class.getResource("/view/RootLayout.fxml"));
rootLayout = (BorderPane) loader.load();
controller = loader.getController();
controller.setDaemon(d);
controller.setConfiguration(config);
controller.setOsums(osums);
controller.fetchQueues();
// rootLayout.setStyle("-fx-background-color: #111;");
// Show the scene containing the root layout.
Scene scene = new Scene(rootLayout);
primaryStage.setScene(scene);
primaryStage.show();
String skin = config.getUiSkin();
new JMetro(skin.equals("light") ? JMetro.Style.LIGHT : JMetro.Style.DARK).applyTheme(scene);
scene.getStylesheets().add(getClass().getResource("/css/application.css").toExternalForm());
} catch (IOException e) {
e.printStackTrace();
DumpManager.addDump(new DebugDump(null, "(Method Start)", "Initialize root layout for UI", "(Method End)", "Could not initialize root layout", false, e));
Alert alert = new Alert(AlertType.ERROR, "Could not initialize root layout, check dumps for details:\n" + e, ButtonType.OK);
alert.setHeaderText("osumer UI Layout Error");
alert.showAndWait();
DumpManager.forceMetricsReport();
Platform.exit();
System.exit(-1);
return;
}
}
use of jfxtras.styles.jmetro8.JMetro in project osumer by mob41.
the class MainController method initialize.
@Override
public void initialize(URL location, ResourceBundle resources) {
beatmapDwnBtn.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
boolean showPreview = showPreviewCheckbox.isSelected();
String idUrl = beatmapUrlText.getText();
if (idUrl == null || idUrl.isEmpty()) {
Alert alert = new Alert(AlertType.WARNING, "Please enter a valid osu! beatmap link/ID.", ButtonType.OK);
alert.showAndWait();
return;
}
addQueue(idUrl, showPreview, true);
}
});
preferencesMenuItem.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
FXMLLoader loader = new FXMLLoader();
loader.setLocation(AppMain.class.getResource("/view/PreferencesLayout.fxml"));
BorderPane borderPane = null;
try {
borderPane = (BorderPane) loader.load();
} catch (IOException e) {
e.printStackTrace();
}
PreferencesController controller = loader.getController();
controller.setD(d);
controller.setConfig(config);
controller.restore();
Scene scene = new Scene(borderPane);
String skin = config.getUiSkin();
new JMetro(skin.equals("light") ? JMetro.Style.LIGHT : JMetro.Style.DARK).applyTheme(scene);
Stage stage = new Stage();
stage.setScene(scene);
// stage.setTitle("Preferences");
stage.initStyle(StageStyle.UTILITY);
stage.initModality(Modality.APPLICATION_MODAL);
stage.showAndWait();
}
});
updatesMenuItem.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
checkUpdate();
checkAnnouncements();
}
});
locateConfigMenuItem.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
String configPath = Osumer.isWindows() ? System.getenv("localappdata") + "\\osumerExpress" : "";
try {
Desktop.getDesktop().open(new File(configPath));
} catch (Exception e) {
e.printStackTrace();
}
}
});
dumpsMenuItem.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
String dumpPath = Osumer.isWindows() ? System.getenv("localappdata") + "\\osumerExpress\\dumps" : "";
File folder = new File(dumpPath);
if (!folder.exists()) {
Alert alert = new Alert(AlertType.ERROR, "There are no dumps currently.", ButtonType.OK);
alert.showAndWait();
return;
}
try {
Desktop.getDesktop().open(folder);
} catch (Exception e) {
e.printStackTrace();
}
}
});
closeMenuItem.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
Platform.exit();
}
});
exitMenuItem.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
try {
d.shutdown();
d = null;
} catch (RemoteException e) {
// e.printStackTrace();
// Alert alert = new Alert(AlertType.ERROR, "Could not shutdown daemon. Please do this manually in task manager by terminating Java VM.", ButtonType.OK);
// alert.showAndWait();
}
Platform.exit();
}
});
docsMenuItem.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
try {
Desktop.getDesktop().browse(new URI("https://github.com/mob41/osumer/wiki"));
;
} catch (Exception e) {
e.printStackTrace();
}
}
});
issueMenuItem.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
try {
Desktop.getDesktop().browse(new URI("https://github.com/mob41/osumer/issues/new"));
;
} catch (Exception e) {
e.printStackTrace();
}
}
});
aboutMenuItem.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
Alert alert = new Alert(AlertType.NONE, "", ButtonType.OK);
alert.setHeaderText("About");
alert.setContentText("osumer2 (" + Osumer.getVersionString() + ")\n" + "Copyright (c) mob41. 2016-2020\n\n" + "osumer is an application that provides osu! players a\n" + "more comfortable and faster way to download beatmaps.");
alert.showAndWait();
}
});
}
Aggregations