Search in sources :

Example 1 with DialogPane

use of javafx.scene.control.DialogPane in project jabref by JabRef.

the class DocumentViewerView method show.

@Override
public void show() {
    FXDialog dialog = new FXDialog(AlertType.INFORMATION, Localization.lang("Document viewer"), false);
    DialogPane dialogPane = (DialogPane) this.getView();
    // Remove button bar at bottom
    dialogPane.getChildren().removeIf(node -> node instanceof ButtonBar);
    dialog.setDialogPane(dialogPane);
    dialog.setResizable(true);
    dialog.show();
}
Also used : DialogPane(javafx.scene.control.DialogPane) ButtonBar(javafx.scene.control.ButtonBar) FXDialog(org.jabref.gui.FXDialog)

Example 2 with DialogPane

use of javafx.scene.control.DialogPane in project TagLauncher_3 by ammarx.

the class Launcher_Main_Controller method launchMineCraft.

@FXML
private void launchMineCraft(ActionEvent event) {
    if (username.getText().equals("")) {
        Alert alert = new Alert(AlertType.ERROR);
        alert.setTitle("Minecraft Launcher - Error");
        alert.setHeaderText("A username is required.");
        alert.setContentText("Please create a username prior to starting Minecraft.");
        alert.initStyle(StageStyle.UTILITY);
        DialogPane dialogPane = alert.getDialogPane();
        dialogPane.getStylesheets().add("taglauncher_3/css/purple.css");
        alert.show();
        return;
    }
    Launcher_Settings.playerUsername = username.getText();
    Launcher_Settings.playerVersion = version.getValue().toString();
    Launcher_Settings.userSettingsSave();
    options.setDisable(true);
    launch.setDisable(true);
    version.setDisable(true);
    username.setDisable(true);
    new Thread(() -> loadPlayerAvatar()).start();
    tagapi_3.API_Interface API = new tagapi_3.API_Interface();
    ExecutorService executor = Executors.newCachedThreadPool();
    executor.submit(() -> {
        // add server
        List ip = new ArrayList(API.getServersIPList());
        if (!ip.contains(Launcher_Settings.serverIP) || ip.isEmpty()) {
            API.addServerToServersDat(Launcher_Settings.serverName, Launcher_Settings.serverIP);
        }
        API.downloadProfile((String) username.getText());
        API.syncVersions();
        if (!Launcher_Settings.fastStartUp) {
            // NOT faststartup
            API.downloadMinecraft((String) version.getValue(), false);
        }
        API.setMinMemory(Integer.parseInt(Launcher_Settings.ramAllocationMin));
        API.setMemory(Integer.parseInt(Launcher_Settings.ramAllocationMax));
        API.setHeight(Integer.parseInt(Launcher_Settings.resolutionHeight));
        API.setWidth(Integer.parseInt(Launcher_Settings.resolutionWidth));
        if (!Launcher_Settings.javaPath.equals("")) {
            API.setJavaPath(Launcher_Settings.javaPath);
        }
        if (!Launcher_Settings.jvmArguments.equals("")) {
            API.setJVMArgument(Launcher_Settings.jvmArguments);
        }
        if (!Launcher_Settings.playerUsername.equals("")) {
            API.setVersionData("Hi " + Launcher_Settings.playerUsername + "!");
        } else {
            API.setVersionData("#AmmarBless");
        }
        Boolean nettyPatch = Launcher_Settings.bypassBlacklist;
        if (Launcher_Settings.fastStartUp) {
            API.runMinecraft(username.getText(), (String) version.getValue(), false, nettyPatch);
        } else {
            API.runMinecraft(username.getText(), (String) version.getValue(), true, nettyPatch);
        }
        return null;
    });
    executor.shutdown();
    Thread t = new Thread(() -> {
        while (true) {
            try {
                if (Launcher_Settings.showDebugStatus == true) {
                    Platform.runLater(() -> {
                        launcherStatus.setText(API.getLog());
                    });
                } else {
                    if (API.getLog().startsWith("[dl] DOWNLOADING...")) {
                        Platform.runLater(() -> {
                            launcherStatus.setText("Status: Checking installed " + Launcher_Settings.playerVersion + " files.");
                        });
                    }
                    if (API.getLog().startsWith("[rl] KEY:")) {
                        Platform.runLater(() -> {
                            launcherStatus.setText("Status: Preparing to start Minecraft.");
                        });
                    }
                    if (API.getLog().startsWith("[rl] Starting")) {
                        Platform.runLater(() -> {
                            launcherStatus.setText("Status: Starting Minecraft " + Launcher_Settings.playerVersion + ".");
                        });
                    }
                }
                Thread.sleep(10);
                if (API.getLog().equals("[rl] Minecraft Initialized!")) {
                    Launcher_Settings.playerUsername = username.getText();
                    Launcher_Settings.playerVersion = version.getValue().toString();
                    Launcher_Settings.userSettingsSave();
                    if (Launcher_Settings.keepLauncherOpen == false) {
                        Platform.runLater(() -> {
                            launcherStatus.setText("Status: Minecraft started, now closing launcher. Have fun!");
                        });
                        API.dumpLogs();
                        System.exit(0);
                    } else {
                        new Thread(() -> checkLatestVersion()).start();
                    }
                    return;
                } else if (API.getLog().equals("[el] Minecraft Corruption found!")) {
                    Platform.runLater(() -> {
                        // STATUS status.setText(API.getLog());
                        launcherStatus.setText("Status: Error. Minecraft file corruption detected!");
                        Alert alert = new Alert(AlertType.ERROR);
                        alert.setTitle("Minecraft Launcher - Error");
                        alert.setHeaderText("Version: " + (String) version.getValue() + " failed to initialize!");
                        alert.setContentText("The game failed to initialize as data corruption \nwas found! Press re-Download game with \n*Force Download* checked in the options menu.");
                        alert.initStyle(StageStyle.UTILITY);
                        DialogPane dialogPane = alert.getDialogPane();
                        dialogPane.getStylesheets().add("taglauncher_3/css/purple.css");
                        alert.showAndWait();
                        API.dumpLogs();
                        username.setDisable(false);
                        options.setDisable(false);
                        launch.setDisable(false);
                        version.setDisable(false);
                    });
                    return;
                }
            } catch (Exception e) {
            }
        }
    });
    t.start();
}
Also used : DialogPane(javafx.scene.control.DialogPane) ScheduledExecutorService(java.util.concurrent.ScheduledExecutorService) ExecutorService(java.util.concurrent.ExecutorService) ArrayList(java.util.ArrayList) Alert(javafx.scene.control.Alert) List(java.util.List) ArrayList(java.util.ArrayList) MalformedURLException(java.net.MalformedURLException) IOException(java.io.IOException) FXML(javafx.fxml.FXML)

Example 3 with DialogPane

use of javafx.scene.control.DialogPane in project TagLauncher_3 by ammarx.

the class Launcher_Options_Controller method mc_launcherVersion.

@FXML
private void mc_launcherVersion(MouseEvent event) {
    Alert alert = new Alert(Alert.AlertType.INFORMATION);
    alert.getDialogPane().getChildren().stream().filter(node -> node instanceof Label).forEach(node -> ((Label) node).setMinHeight(Region.USE_PREF_SIZE));
    alert.setTitle("Minecraft Launcher - Credits");
    alert.setHeaderText("So long, and thanks for all the fish.");
    alert.initStyle(StageStyle.UTILITY);
    DialogPane dialogPane = alert.getDialogPane();
    dialogPane.getStylesheets().add("taglauncher_3/css/purple.css");
    alert.setContentText("" + "Minotar.net: API used for the Avatars.\n" + "Mojang: A little thing called Minecraft.\n" + "maxd @ Github: Great dark Modena theme.\n" + "Ammar_Ahmad: The brains behind the code.\n" + "Chalkie: Pressed 'compile' that one time.\n\n" + "© TagCraftMC.com & TerraPrimal.com\n");
    alert.show();
}
Also used : Button(javafx.scene.control.Button) StageStyle(javafx.stage.StageStyle) Launcher_Main(taglauncher_3.Launcher_Main) Initializable(javafx.fxml.Initializable) URL(java.net.URL) MouseEvent(javafx.scene.input.MouseEvent) Callable(java.util.concurrent.Callable) Launcher_Settings(taglauncher_3.Launcher_Settings) ResourceBundle(java.util.ResourceBundle) ComboBox(javafx.scene.control.ComboBox) Tooltip(javafx.scene.control.Tooltip) Hashtable(java.util.Hashtable) ExecutorService(java.util.concurrent.ExecutorService) Alert(javafx.scene.control.Alert) TextField(javafx.scene.control.TextField) Label(javafx.scene.control.Label) KeyEvent(javafx.scene.input.KeyEvent) File(java.io.File) Executors(java.util.concurrent.Executors) Platform(javafx.application.Platform) FXML(javafx.fxml.FXML) FileChooser(javafx.stage.FileChooser) ActionEvent(javafx.event.ActionEvent) DialogPane(javafx.scene.control.DialogPane) Region(javafx.scene.layout.Region) Stage(javafx.stage.Stage) RadioButton(javafx.scene.control.RadioButton) ImageView(javafx.scene.image.ImageView) Launcher_Main_Controller(taglauncher_3.gui.main.Launcher_Main_Controller) ObservableValue(javafx.beans.value.ObservableValue) ChangeListener(javafx.beans.value.ChangeListener) ExtensionFilter(javafx.stage.FileChooser.ExtensionFilter) Image(javafx.scene.image.Image) Toolkit(java.awt.Toolkit) DialogPane(javafx.scene.control.DialogPane) Label(javafx.scene.control.Label) Alert(javafx.scene.control.Alert) FXML(javafx.fxml.FXML)

Example 4 with DialogPane

use of javafx.scene.control.DialogPane in project FinalCrypt by ron-from-nl.

the class GUIFX method cipherInfoLabelClicked.

// ================================================= END UPDATE PROGRESS ===========================================================
@FXML
private void cipherInfoLabelClicked(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 is your secret Cipher file?");
    alert.setResizable(true);
    String infotext = new String();
    infotext = "Any personal photo or video can be your cipher file.\r\n";
    infotext += "FinalCrypt de/encrypts your files with your cipher file.\r\n";
    infotext += "Data in your cipher file is like a huge binary password.\r\n";
    infotext += "\r\n";
    infotext += "Keep backups of your cipher file and keep it SECRET!\r\n";
    infotext += "Without cipher file you can NEVER decrypt your data!\r\n";
    infotext += "\r\n";
    infotext += "==================================\r\n";
    infotext += "\r\n";
    infotext += "Best practice is a cipher file of at least 1 MB in size\r\n";
    infotext += "Don't keep cipher files on your computer for too long\r\n";
    infotext += "to prevent someone or something copying of it.\r\n";
    infotext += "\r\n";
    infotext += "Encryption / Decryption (advanced explanation):\r\n";
    infotext += "\r\n";
    infotext += "Your cipher bit patterns negate your file bit patterns.\r\n";
    infotext += "\r\n";
    infotext += "                  Encrypt                      Decrypt\r\n";
    infotext += "Data byte: 00000011 = 3    ╭─> 00000110 = 6\r\n";
    infotext += "Ciph byte: 00000101 = 5    │      00000101 = 5\r\n";
    infotext += "Encr byte: 00000110 = 6 ─╯       00000011 = 3\r\n\r\n";
    // infotext += " \r\n";
    alert.setContentText(infotext);
    alert.showAndWait();
}
Also used : DialogPane(javafx.scene.control.DialogPane) Alert(javafx.scene.control.Alert) FXML(javafx.fxml.FXML)

Example 5 with DialogPane

use of javafx.scene.control.DialogPane in project FinalCrypt by ron-from-nl.

the class GUIFX method introAlert.

public Alert introAlert(AlertType type, String title, String headerText, String message, String optOutMessage, Consumer<Boolean> optOutAction, ButtonType... buttonTypes) {
    Alert alert = new Alert(type);
    alert.getDialogPane().applyCss();
    Node graphic = alert.getDialogPane().getGraphic();
    DialogPane dialogPane = new DialogPane() {

        @Override
        protected Node createDetailsButton() {
            CheckBox checkbox = new CheckBox();
            checkbox.setText(optOutMessage);
            checkbox.setOnAction(e -> optOutAction.accept(checkbox.isSelected()));
            return checkbox;
        }
    };
    dialogPane.getStylesheets().add(getClass().getResource("myInfoAlerts.css").toExternalForm());
    dialogPane.getStyleClass().add("myDialog");
    alert.setDialogPane(dialogPane);
    alert.getDialogPane().getButtonTypes().addAll(buttonTypes);
    alert.getDialogPane().setContentText(message);
    alert.getDialogPane().setExpandableContent(new Group());
    alert.getDialogPane().setExpanded(true);
    alert.getDialogPane().setGraphic(graphic);
    alert.setTitle(title);
    alert.setHeaderText(headerText);
    return alert;
}
Also used : DialogPane(javafx.scene.control.DialogPane) Group(javafx.scene.Group) CheckBox(javafx.scene.control.CheckBox) Node(javafx.scene.Node) SwingNode(javafx.embed.swing.SwingNode) Alert(javafx.scene.control.Alert)

Aggregations

DialogPane (javafx.scene.control.DialogPane)10 Alert (javafx.scene.control.Alert)8 FXML (javafx.fxml.FXML)6 ExecutorService (java.util.concurrent.ExecutorService)3 Label (javafx.scene.control.Label)3 Stage (javafx.stage.Stage)3 File (java.io.File)2 IOException (java.io.IOException)2 URL (java.net.URL)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2 ResourceBundle (java.util.ResourceBundle)2 ButtonType (javafx.scene.control.ButtonType)2 TextArea (javafx.scene.control.TextArea)2 GridPane (javafx.scene.layout.GridPane)2 PlatformImpl (com.sun.javafx.application.PlatformImpl)1 Component (java.awt.Component)1 Container (java.awt.Container)1 Desktop (java.awt.Desktop)1 Font (java.awt.Font)1