Skip to content

Commit

Permalink
Fix: Preset dialogs not appearing on MacOS #131
Browse files Browse the repository at this point in the history
  • Loading branch information
SonarSonic committed Apr 12, 2024
1 parent 68c0022 commit a42104f
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/main/java/drawingbot/javafx/FXHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,7 @@ public static void openFolder(File directory){
public static void initSeparateStageWithController(String fmxlPath, Stage stage, Object controller, String stageTitle, Modality modality){
try {
FXMLLoader exportUILoader = new FXMLLoader(FXController.class.getResource(fmxlPath));
exportUILoader.setClassLoader(FXController.class.getClassLoader());
exportUILoader.setController(controller);
initSeparateStageProps(exportUILoader.load(), stage, stageTitle, modality);
} catch (IOException e) {
Expand All @@ -413,6 +414,7 @@ public static void initSeparateStageWithController(String fmxlPath, Stage stage,
public static <T> T initSeparateStage(String fmxlPath, Stage stage, String stageTitle, Modality modality){
try {
FXMLLoader exportUILoader = new FXMLLoader(FXController.class.getResource(fmxlPath));
exportUILoader.setClassLoader(FXController.class.getClassLoader());
Parent root = exportUILoader.load();
T controller = exportUILoader.getController();
exportUILoader.setController(controller);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public class ControlDrawingSetEditor extends VBox {

public ControlDrawingSetEditor() {
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("drawingseteditor.fxml"));
fxmlLoader.setClassLoader(getClass().getClassLoader());
fxmlLoader.setRoot(this);
fxmlLoader.setControllerFactory(c -> this);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public class ControlImageFiltersEditor extends VBox {

public ControlImageFiltersEditor() {
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("imagefilterseditor.fxml"));
fxmlLoader.setClassLoader(getClass().getClassLoader());
fxmlLoader.setRoot(this);
fxmlLoader.setControllerFactory(c -> this);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public class ControlPFMSettingsEditor extends VBox implements ISpecialListenable

public ControlPFMSettingsEditor() {
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("pfmsettingseditor.fxml"));
fxmlLoader.setClassLoader(getClass().getClassLoader());
fxmlLoader.setRoot(this);
fxmlLoader.setControllerFactory(c -> this);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public Node getContent() {
if(root == null && !loadFailed){
try {
FXMLLoader fxmlLoader = new FXMLLoader(ControllerNode.class.getResource(fxmlPath));
fxmlLoader.setClassLoader(getClass().getClassLoader());
root = fxmlLoader.load();
controller = fxmlLoader.getController();
fxmlLoader.setController(controller);
Expand Down

0 comments on commit a42104f

Please sign in to comment.