use of javafx.scene.control.DialogPane in project aic-praise by aic-sri-international.
the class FXUtil method exception.
public static void exception(Throwable th) {
Dialog<ButtonType> dialog = new Dialog<ButtonType>();
dialog.setTitle("Program exception");
final DialogPane dialogPane = dialog.getDialogPane();
dialogPane.setContentText("Details of the problem:");
dialogPane.getButtonTypes().addAll(ButtonType.OK);
dialogPane.setContentText(th.getMessage());
dialog.initModality(Modality.APPLICATION_MODAL);
Label label = new Label("Exception stacktrace:");
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
th.printStackTrace(pw);
pw.close();
TextArea textArea = new TextArea(sw.toString());
textArea.setEditable(false);
textArea.setWrapText(true);
textArea.setMaxWidth(Double.MAX_VALUE);
textArea.setMaxHeight(Double.MAX_VALUE);
GridPane.setVgrow(textArea, Priority.ALWAYS);
GridPane.setHgrow(textArea, Priority.ALWAYS);
GridPane root = new GridPane();
root.setVisible(false);
root.setMaxWidth(Double.MAX_VALUE);
root.add(label, 0, 0);
root.add(textArea, 0, 1);
dialogPane.setExpandableContent(root);
dialog.showAndWait();
}
use of javafx.scene.control.DialogPane in project FinalCrypt by ron-from-nl.
the class GUIFX method welcome.
private void welcome() {
targetFCPathList = new FCPathList();
updateDashboard(targetFCPathList);
configuration = new Configuration(ui);
version = new Version(ui);
version.checkCurrentlyInstalledVersion(this);
status("Welcome to " + Version.getProduct() + " " + version.getCurrentlyInstalledOverallVersionString() + "\r\n", false);
log("Welcome to " + Version.getProduct() + " " + version.getCurrentlyInstalledOverallVersionString() + "\r\n");
log("Copyright: " + Version.getCopyright() + " " + Version.getAuthor() + "\r\n");
log("Email: " + Version.getAuthorEmail() + "\r\n");
log("Logfiles: " + configuration.getLogDirPath().toString() + "\r\n");
log("\r\n");
log("Tip: FinalCrypt command line (DOS) usage:\r\n");
log("java -cp FinalCrypt.jar rdj/CLUI --help\r\n");
log("\r\n");
copyrightLabel.setText("Copyright: " + Version.getCopyright() + " " + Version.getAuthor());
// cpuIndicator
Rectangle rect = new Rectangle(0, 0, 100, 100);
Tooltip cpuIndicatorToolTip = new Tooltip("Process CPU Load");
Tooltip.install(rect, cpuIndicatorToolTip);
cpuIndicator.setTooltip(cpuIndicatorToolTip);
// for: ProcessCpuLoad()
// procCPULoadAttribute = "ProcessCpuLoad";
mbs = ManagementFactory.getPlatformMBeanServer();
try {
name = ObjectName.getInstance("java.lang:type=OperatingSystem");
} catch (MalformedObjectNameException | NullPointerException ex) {
status(ex.getMessage(), true);
}
Timeline timeline = new Timeline(new KeyFrame(Duration.millis(200), ae -> cpuIndicator.setProgress(getProcessCpuLoad())));
timeline.setCycleCount(Animation.INDEFINITE);
timeline.play();
Platform.runLater(new Runnable() {
@Override
public void run() {
String title = "Welcome to " + Version.getProduct();
String header = "Brief Introduction:";
String infotext = "Step 1 Select items to en/decrypt on the left side.\r\n";
infotext += "Step 2 Select personal cipher file on the right side.\r\n";
infotext += "Step 3 Click [Encrypt] or [Decrypt] at the bottom left.\r\n";
infotext += "\r\n";
infotext += "That's it! Not hard right?\r\n";
infotext += "\r\n";
infotext += "Optional:\r\n";
infotext += "\r\n";
infotext += "Double click to open files.\r\n";
infotext += "Click [LOG] to see details.\r\n";
infotext += "Click [Check Update] sometimes.\r\n";
infotext += "Tip: Watch statusbar at bottom.\r\n";
infotext += "Tip: Make backups of your data.\r\n";
infotext += "\r\n";
infotext += "Live to love - Enjoy your privacy.\r\n\r\n";
/*
Linux: ${user.home}/.java/.userPrefs/_\!\(\)\!~\!\"q\!#4\!\[w\"_\!%k\!\[g\"\}\!#@\!\<\!\=\=/prefs.xml
For Windows systemRoot and userRoot are stored in HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Prefs and HKEY_CURRENT_USER\Software\JavaSoft\Prefs respectively.
For Unix systemRoot and userRoot are stored in "/etc/.java" and "${user.home}/.java/.userPrefs", respectively.
Note that for Unix the locations can be changed by specifying "java.util.prefs.userRoot" and "java.util.prefs.systemRoot" properties
Mac OS X ~/Library/Preferences in multiple plist files.
Mac OS X uses the java.util.prefs.MacOSXPreferencesFactory class. See lists.apple.com/archives/java-dev/2010/Jul/msg00056.html
the java.util.prefs.MacOSXPreferencesFactory class should be in rt.jar in JDK 1.7 or later.
See hg.openjdk.java.net/macosx-port/macosx-port/jdk/file/… for the source code.
JDK 8 all the items in java.util.prefs:
*/
Preferences prefs = Preferences.userRoot().node(this.getClass().getName());
// if no val then "Unknown" prefs location registry: HKEY_CURRENT_USER\Software\JavaSoft\Prefs
String val = prefs.get("Hide Intro", "Unknown");
if (!val.equals("Yes")) {
Alert alert = introAlert(AlertType.INFORMATION, title, header, infotext, "Don't show again", param -> prefs.put("Hide Intro", param ? "Yes" : "No"), ButtonType.OK);
if (alert.showAndWait().filter(t -> t == ButtonType.OK).isPresent()) {
}
}
}
});
Alert alert = new Alert(AlertType.INFORMATION);
// Style the Alert
DialogPane dialogPane = alert.getDialogPane();
dialogPane.getStylesheets().add(getClass().getResource("myInfoAlerts.css").toExternalForm());
dialogPane.getStyleClass().add("myDialog");
// alert.setTitle("Info");
// alert.setHeaderText("Welcome");
// alert.setResizable(true);
// String infotext = new String();
// infotext = "Welcome.\r\n";
// alert.setContentText(infotext);
// alert.setOnShowing(new EventHandler<DialogEvent>()
// {
// @Override
// public void handle(DialogEvent event)
// {
// // JavaFX Delay Timer to prevent not on application thread error
// Timeline timeline = new Timeline(new KeyFrame( Duration.millis(1000), ae ->
// alert.close()
// )); timeline.play();
// }
// });
// alert.showAndWait();
}
use of javafx.scene.control.DialogPane in project FinalCrypt by ron-from-nl.
the class GUIFX method targetInfoLabelClicked.
@FXML
private void targetInfoLabelClicked(MouseEvent event) {
Alert alert = new Alert(AlertType.INFORMATION);
// Style the Alert
DialogPane dialogPane = alert.getDialogPane();
dialogPane.getStylesheets().add(getClass().getResource("myInfoAlerts.css").toExternalForm());
dialogPane.getStyleClass().add("myDialog");
alert.setTitle("Information Dialog");
alert.setHeaderText("What about your selected items?");
alert.setResizable(true);
String infotext = new String();
infotext = "These are the files and maps you want to en / decrypt.\r\n";
infotext += "Hold down [Ctrl] / [Shift] to select multiple items.\r\n";
infotext += "\r\n";
infotext += "Encrypted files get the \".bit\" extension added.\r\n";
infotext += "Decrypted files get the \".bit\" extension removed.\r\n";
infotext += "\r\n";
infotext += "Original files are securely deleted after en / decryption.\r\n";
infotext += "\r\n";
alert.setContentText(infotext);
alert.showAndWait();
}
use of javafx.scene.control.DialogPane in project TagLauncher_3 by ammarx.
the class Launcher_Main_Controller method showFirstTimeMessage.
public void showFirstTimeMessage() {
Alert alert = new Alert(AlertType.INFORMATION);
alert.setTitle("Minecraft Launcher - Welcome");
alert.setHeaderText("Greetings Player...");
alert.setContentText("" + "It looks like this is your first time using our launcher and we wanted to provide you with some help.\n\n" + "By default, the launcher doesn't come with any versions of Minecraft installed so you will need to download the version you wish to play via the options menu.\n\n" + "Once in the options menu, click the dropdown menu under the Version Settings title and choose the version you want. When you have chosen, click the download button and wait for the launcher to download all the necessary files.");
alert.initStyle(StageStyle.UTILITY);
DialogPane dialogPane = alert.getDialogPane();
dialogPane.getStylesheets().add("taglauncher_3/css/purple.css");
Stage stage = (Stage) dialogPane.getScene().getWindow();
stage.setAlwaysOnTop(true);
stage.toFront();
alert.show();
}
use of javafx.scene.control.DialogPane in project TagLauncher_3 by ammarx.
the class Launcher_Options_Controller method _optionsSelectVersionInstall.
@FXML
private void _optionsSelectVersionInstall(ActionEvent event) {
if (optionsSelectVersion.getValue() == null || optionsSelectVersion.getValue().equals("")) {
Alert alert = new Alert(Alert.AlertType.ERROR);
alert.setTitle("Minecraft Launcher - Error");
alert.setHeaderText("Invaild selection.");
alert.setContentText("Please select a version to install prior to installing.");
alert.initStyle(StageStyle.UTILITY);
DialogPane dialogPane = alert.getDialogPane();
dialogPane.getStylesheets().add("taglauncher_3/css/purple.css");
alert.show();
return;
}
optionsSelectVersionInstall.setDisable(true);
optionsExit.setDisable(true);
optionsClose.setDisable(true);
optionsSelectVersion.setDisable(true);
if (optionsSelectVersionForce.isSelected()) {
System.out.println("Selected!");
} else {
System.out.println("NOT Selected!");
}
tagapi_3.API_Interface API = new tagapi_3.API_Interface();
ExecutorService executor = Executors.newCachedThreadPool();
executor.submit(() -> {
API.downloadMinecraft((String) optionsSelectVersion.getValue(), optionsSelectVersionForce.isSelected());
return null;
});
executor.shutdown();
Thread t = new Thread(() -> {
while (true) {
try {
Platform.runLater(() -> {
if (Launcher_Settings.showDebugStatus == true) {
optionStatus.setText(API.getLog());
} else {
if (API.getLog().startsWith("[dl] URL: https://launchermeta")) {
optionStatus.setText("Status: " + Launcher_Settings.Status.DOWNLOADING_LM);
}
if (API.getLog().startsWith("[dl] DOWNLOADING...HASH:")) {
optionStatus.setText("Status: " + Launcher_Settings.Status.DOWNLOADING);
}
if (API.getLog().startsWith("[dl] DOWNLOADING MINECRAFT JAR")) {
optionStatus.setText("Status: " + Launcher_Settings.Status.DOWNLOADING_M);
}
if (API.getLog().startsWith("[dl] Downloading: https://libraries")) {
optionStatus.setText("Status: " + Launcher_Settings.Status.DOWNLOADING_L);
}
if (API.getLog().startsWith("[dl] Getting NATIVES URL")) {
optionStatus.setText("Status: " + Launcher_Settings.Status.FINALIZING);
}
}
});
Thread.sleep(10);
if (API.getLog().equals("[dl] Download Complete!")) {
Platform.runLater(() -> {
optionStatus.setText("Status: " + Launcher_Settings.Status.DOWNLOAD_COMPLETE);
Alert alert = new Alert(Alert.AlertType.INFORMATION);
alert.setTitle("Minecraft Launcher - Success");
alert.setHeaderText("Download Complete.");
alert.initStyle(StageStyle.UTILITY);
DialogPane dialogPane = alert.getDialogPane();
dialogPane.getStylesheets().add("taglauncher_3/css/purple.css");
alert.setContentText("Version: " + (String) optionsSelectVersion.getValue() + " has been downloaded & installed!");
;
optionStatus.setText("Status: " + Launcher_Settings.Status.IDLE);
optionsSelectVersionInstall.setDisable(false);
optionsExit.setDisable(false);
optionsClose.setDisable(false);
optionsSelectVersion.setDisable(false);
optionsSelectFastStart.setSelected(false);
Launcher_Settings.refreshVersionList = true;
Launcher_Settings.fastStartUp = false;
alert.showAndWait();
API.dumpLogs();
});
return;
}
} catch (Exception e) {
}
}
});
t.start();
}
Aggregations