28
28
import javafx .event .ActionEvent ;
29
29
import javafx .event .EventHandler ;
30
30
import javafx .fxml .FXML ;
31
+ import javafx .scene .control .Button ;
32
+ import javafx .scene .control .Label ;
33
+ import javafx .scene .control .Menu ;
34
+ import javafx .scene .control .MenuBar ;
35
+ import javafx .scene .control .MenuItem ;
36
+ import javafx .scene .control .TextField ;
31
37
import javafx .scene .control .*;
32
38
import javafx .scene .effect .DropShadow ;
33
39
import javafx .scene .input .MouseEvent ;
52
58
53
59
import static com .airsquared .blobsaver .Main .appPrefs ;
54
60
import static com .airsquared .blobsaver .Main .primaryStage ;
55
- import static com .airsquared .blobsaver .Shared .githubIssue ;
56
- import static com .airsquared .blobsaver .Shared .newReportableError ;
57
- import static com .airsquared .blobsaver .Shared .newUnreportableError ;
58
- import static com .airsquared .blobsaver .Shared .redditPM ;
59
- import static com .airsquared .blobsaver .Shared .reportError ;
60
- import static com .airsquared .blobsaver .Shared .resizeAlertButtons ;
61
+ import static com .airsquared .blobsaver .Shared .*;
61
62
62
63
public class Controller {
63
64
@@ -335,7 +336,7 @@ public void initialize() {
335
336
@ Override
336
337
public void handle (WindowEvent event ) {
337
338
useMacOSMenuBar ();
338
- log ("using macos menu bar" );
339
+ log ("using macOS menu bar" );
339
340
primaryStage .removeEventHandler (event .getEventType (), this );
340
341
}
341
342
});
@@ -851,11 +852,23 @@ public void aboutMenuHandler() {
851
852
ButtonType viewLicense = new ButtonType ("View License" );
852
853
ButtonType librariesUsed = new ButtonType ("Libraries Used" );
853
854
ButtonType donate = new ButtonType ("Donate!" );
854
- Alert alert = new Alert (Alert .AlertType .INFORMATION , "About text here" , librariesUsed , viewLicense , donate , githubRepo , ButtonType .OK );
855
+ ButtonType customOK = new ButtonType ("OK" , ButtonBar .ButtonData .CANCEL_CLOSE );
856
+ Alert alert = new Alert (Alert .AlertType .INFORMATION , "About text here" ,
857
+ librariesUsed , viewLicense , donate , githubRepo , customOK );
855
858
alert .setTitle ("About" );
859
+
860
+ //Deactivate default behavior for librariesUsed Button:
861
+ Button libButton = (Button ) alert .getDialogPane ().lookupButton (librariesUsed );
862
+ libButton .setDefaultButton (false );
863
+
864
+ //Activate default behavior for OK-Button:
865
+ Button OkButton = (Button ) alert .getDialogPane ().lookupButton (customOK );
866
+ OkButton .setDefaultButton (true );
867
+
856
868
alert .setHeaderText ("blobsaver " + Main .appVersion );
857
869
alert .setContentText ("blobsaver Copyright (c) 2018 airsquared\n \n " +
858
870
"This program is licensed under GNU GPL v3.0-only" );
871
+
859
872
resizeAlertButtons (alert );
860
873
alert .showAndWait ();
861
874
switch (alert .getResult ().getText ()) {
@@ -885,7 +898,7 @@ public void aboutMenuHandler() {
885
898
out .close ();
886
899
licenseFile .deleteOnExit ();
887
900
licenseFile .setReadOnly ();
888
- java . awt . Desktop .getDesktop ().edit (licenseFile );
901
+ Desktop .getDesktop ().edit (licenseFile );
889
902
} catch (IOException e ) {
890
903
e .printStackTrace ();
891
904
}
@@ -909,7 +922,7 @@ public void aboutMenuHandler() {
909
922
out .close ();
910
923
libsUsedFile .deleteOnExit ();
911
924
libsUsedFile .setReadOnly ();
912
- java . awt . Desktop .getDesktop ().edit (libsUsedFile );
925
+ Desktop .getDesktop ().edit (libsUsedFile );
913
926
} catch (IOException e ) {
914
927
e .printStackTrace ();
915
928
}
@@ -956,7 +969,7 @@ private void useMacOSMenuBar() {
956
969
windowMenu .getItems ().add (tk .createMinimizeMenuItem ());
957
970
windowMenu .getItems ().add (tk .createCycleWindowsItem ());
958
971
959
- MenuItem debugLogMenuItem = new MenuItem ("Open/Close Debug log " );
972
+ MenuItem debugLogMenuItem = new MenuItem ("Open/Close Debug Log " );
960
973
debugLogMenuItem .setOnAction (event -> {
961
974
debugLogHandler ();
962
975
tk .setMenuBar (DebugWindow .getDebugStage (), macOSMenuBar );
@@ -1135,7 +1148,9 @@ public void resetAppHandler() {
1135
1148
try {
1136
1149
Alert confirmationAlert = new Alert (Alert .AlertType .CONFIRMATION , "Are you sure you would like to uninstall this application?" , ButtonType .NO , ButtonType .YES );
1137
1150
confirmationAlert .showAndWait ();
1138
- if ((confirmationAlert .getResult () == null ) || ButtonType .CANCEL .equals (confirmationAlert .getResult ()) || ButtonType .NO .equals (confirmationAlert .getResult ())) {
1151
+ if ((confirmationAlert .getResult () == null )
1152
+ || ButtonType .CANCEL .equals (confirmationAlert .getResult ())
1153
+ || ButtonType .NO .equals (confirmationAlert .getResult ())) {
1139
1154
return ;
1140
1155
}
1141
1156
Preferences prefs = Preferences .userRoot ().node ("airsquared/blobsaver" );
0 commit comments