mirror of
https://github.com/developersu/ns-usbloader.git
synced 2025-05-22 03:05:24 -04:00
Initial commit
This commit is contained in:
commit
c21417c043
20 changed files with 1904 additions and 0 deletions
41
src/main/java/nsusbloader/ServiceWindow.java
Normal file
41
src/main/java/nsusbloader/ServiceWindow.java
Normal file
|
@ -0,0 +1,41 @@
|
|||
package nsusbloader;
|
||||
|
||||
import javafx.scene.control.Alert;
|
||||
import javafx.scene.control.ButtonType;
|
||||
import javafx.scene.layout.Region;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
public class ServiceWindow {
|
||||
/**
|
||||
* Create window with notification
|
||||
* */
|
||||
static void getErrorNotification(String title, String body){
|
||||
Alert alertBox = new Alert(Alert.AlertType.ERROR);
|
||||
alertBox.setTitle(title);
|
||||
alertBox.setHeaderText(null);
|
||||
alertBox.setContentText(body);
|
||||
alertBox.getDialogPane().setMinWidth(Region.USE_PREF_SIZE);
|
||||
alertBox.getDialogPane().setMinHeight(Region.USE_PREF_SIZE);
|
||||
alertBox.setResizable(true); // Java bug workaround for JDR11/OpenJFX. TODO: nothing. really.
|
||||
alertBox.setResizable(false);
|
||||
alertBox.getDialogPane().getStylesheets().add("/res/app.css");
|
||||
alertBox.show();
|
||||
}
|
||||
static boolean getConfirmationWindow(String title, String body){
|
||||
Alert alertBox = new Alert(Alert.AlertType.CONFIRMATION);
|
||||
alertBox.setTitle(title);
|
||||
alertBox.setHeaderText(null);
|
||||
alertBox.setContentText(body);
|
||||
alertBox.getDialogPane().setMinWidth(Region.USE_PREF_SIZE);
|
||||
alertBox.getDialogPane().setMinHeight(Region.USE_PREF_SIZE);
|
||||
alertBox.setResizable(true); // Java bug workaround for JDR11/OpenJFX. TODO: nothing. really.
|
||||
alertBox.getDialogPane().getStylesheets().add("/res/app.css");
|
||||
Optional<ButtonType> result = alertBox.showAndWait();
|
||||
if (result.get() == ButtonType.OK)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue