src/ui/dialog/Dialogs.java
/*
     * Show the error dialog once for every exception in the queue.
     */
Show the error dialog once for every exception in the queue.
Show the error dialog once for every exception in the queue .
public static void showErrorDialog() {
        while (Model.getInstance().hasException()) {
            try {
                final Parent root = FXMLLoader.load(Dialogs.class.getResource("/resources/fxml/ErrorDialog.fxml"));
                showDialog(root, new OnShownAction() {
                    @Override
                    public void perform() {
                        for (Node node : root.lookupAll(".button")) {
                            if (node instanceof Button && ((Button)node).isDefaultButton()) {
                                node.requestFocus();
                            }
                        }
                    }
                });
            } catch (IOException ex) {
                showBackupErrorDialog();
            }
        }
    }
public static void showErrorDialog ( ) { while ( Model . getInstance ( ) . hasException ( ) ) { try { final Parent root = FXMLLoader . load ( Dialogs . class . getResource ( "/resources/fxml/ErrorDialog.fxml" ) ) ; showDialog ( root , new OnShownAction ( ) { @ Override public void perform ( ) { for ( Node node : root . lookupAll ( ".button" ) ) { if ( node instanceof Button && ( ( Button ) node ) . isDefaultButton ( ) ) { node . requestFocus ( ) ; } } } } ) ; } catch ( IOException ex ) { showBackupErrorDialog ( ) ; } } }
Show the error dialog once for every exception in the queue.
Show the error dialog once for every exception in the queue .
// When the dialog is shown, make sure the default button has focus as well. // If I don't do this, the quit button might get the initial focus, // which is not only risky, it looks weird too.