MCPcopy Create free account
hub / github.com/PCGen/pcgen / AboutDialog

Class AboutDialog

code/src/java/pcgen/gui3/dialog/AboutDialog.java:40–106  ·  view source on GitHub ↗

This is the application logic for the "About Dialog" @see pcgen.gui3.JFXPanelFromResource

Source from the content-addressed store, hash-verified

38 * @see pcgen.gui3.JFXPanelFromResource
39 */
40public class AboutDialog implements Controllable<AboutDialogController>
41{
42 private final FXMLLoader loader = new FXMLLoader();
43 private final Stage primaryStage;
44
45 public AboutDialog(Stage parentStage)
46 {
47 this.primaryStage = parentStage;
48
49 loader.setResources(LanguageBundle.getBundle());
50 loader.setLocation(getClass().getResource("AboutDialog.fxml"));
51
52 final Scene scene;
53 try
54 {
55 scene = loader.load();
56 scene.addEventHandler(KeyEvent.KEY_PRESSED, keyEvent -> {
57 if (keyEvent.getCode()== KeyCode.ESCAPE)
58 {
59 primaryStage.hide();
60 }
61 });
62 } catch (IOException e)
63 {
64 Logging.errorPrint("failed to load preloader", e);
65 return;
66 }
67
68 primaryStage.setScene(scene);
69 }
70
71 /**
72 * @return the controller for the preloader
73 */
74 @Override
75 public AboutDialogController getController()
76 {
77 GuiAssertions.assertIsNotJavaFXThread();
78 return CompletableFuture
79 .supplyAsync(loader::<AboutDialogController>getController)
80 .join();
81 }
82
83 /**
84 * Shows the About dialog window
85 */
86 public void show()
87 {
88 // Fix for Mac, when the window is maximized
89 if (primaryStage.isFullScreen())
90 {
91 primaryStage.setFullScreen(false);
92 }
93 // Fix for other platforms
94 if (primaryStage.isMaximized())
95 {
96 primaryStage.setMaximized(false);
97 }

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected