Skip to content

Commit

Permalink
Fix SudoMain DynamicFontSize : Resolved circular dependencies between…
Browse files Browse the repository at this point in the history
… them with fxmlService.setDynamicFontSize() method.
  • Loading branch information
Lob2018 committed Feb 5, 2025
1 parent 6ab1a04 commit 2da7a30
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/main/java/fr/softsf/sudokufx/SudoMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ private void initializeFxmlService() {
if (fxmlService == null) {
fxmlService = new FxmlService(new FXMLLoader());
}
fxmlService.setDynamicFontSize(new DynamicFontSize());
fxmlService.setDynamicFontSize();
}

/**
Expand Down
9 changes: 7 additions & 2 deletions src/main/java/fr/softsf/sudokufx/service/FxmlService.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import javafx.application.Platform;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

Expand All @@ -24,7 +23,6 @@ public class FxmlService implements ISceneProvider {

private final FXMLLoader fxmlLoader;

@Setter
private DynamicFontSize dynamicFontSize;

/**
Expand All @@ -38,6 +36,13 @@ public FxmlService(FXMLLoader fxmlLoader) {
this.fxmlLoader = fxmlLoader;
}

/**
* Initializes dynamic font sizing for the scene.
*/
public void setDynamicFontSize() {
this.dynamicFontSize = new DynamicFontSize();
}

/**
* Sets the root of the scene based on the given FXML file name, and adapt the font size dynamically
*
Expand Down

0 comments on commit 2da7a30

Please sign in to comment.