Skip to content

Commit

Permalink
Fix "Toolkit not initialized" using JFXPanel
Browse files Browse the repository at this point in the history
Not sure why this works, but it does :) There's probably a better
solution.
  • Loading branch information
sebastian-berlin-wmse committed Jan 31, 2022
1 parent 17b4841 commit 872feec
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 15 deletions.
4 changes: 3 additions & 1 deletion build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@

<target name="compile">
<mkdir dir="bin"/>
<javac includeantruntime="false" srcdir="src" destdir="bin">
<javac includeantruntime="false" srcdir="src" destdir="bin" debug="true">
<classpath refid="classpath" />
<compilerarg line="--module-path ${openjfxSDKPath}"/>
<compilerarg line="--add-modules javafx.web"/>
<compilerarg line="--add-modules javafx.swing"/>
</javac>
</target>

Expand All @@ -31,6 +32,7 @@
<include name="javafx.base.jar"/>
<include name="javafx.graphics.jar"/>
<include name="javafx.controls.jar"/>
<include name="javafx.swing.jar"/>
</fileset>
<patternset>
<exclude name="META-INF/MANIFEST.MF"/>
Expand Down
3 changes: 3 additions & 0 deletions src/pattypan/Launcher.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package pattypan;

import javafx.embed.swing.JFXPanel;

public class Launcher {
public static void main(String[] args) {
new JFXPanel();
Main.main(args);
}
}
9 changes: 4 additions & 5 deletions src/pattypan/LogManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,14 @@ public class LogManager {

public LogManager() {
try {
Path logFileLocation = Paths.get("./logs");
// Path logFileLocation = Paths.get(Util.getApplicationDirectory() + "/logs");
Path logFileLocation = Paths.get(Util.getApplicationDirectory() + "/logs");
if (!Files.exists(logFileLocation)) {
Files.createDirectories(logFileLocation);
}

// if (!Settings.getSetting("version").equals(Settings.VERSION)) {
// Files.deleteIfExists(Paths.get(logFileLocation.toString() + "/pattypan.log"));
// }
if (!Settings.getSetting("version").equals(Settings.VERSION)) {
Files.deleteIfExists(Paths.get(logFileLocation.toString() + "/pattypan.log"));
}

FileHandler fh = new FileHandler(logFileLocation.toString() + "/pattypan.log", true);
fh.setFormatter(new SimpleFormatter());
Expand Down
18 changes: 9 additions & 9 deletions src/pattypan/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,19 +70,19 @@ public static void main(String[] args) {
}
}

// Settings.readProperties();
Settings.readProperties();

// Session.LOGGER.log(Level.INFO,
// "Wiki set as: {0}\nProtocol set as: {1}\nScript path set as: {2}",
// new String[]{wiki, protocol, scriptPath}
// );
Session.LOGGER.log(Level.INFO,
"Wiki set as: {0}\nProtocol set as: {1}\nScript path set as: {2}",
new String[]{wiki, protocol, scriptPath}
);

String os = System.getProperty("os.name");

// Session.LOGGER.log(Level.INFO,
// "Operating System: {0}\nPattypan Version: {1}",
// new String[]{os, Settings.VERSION}
// );
Session.LOGGER.log(Level.INFO,
"Operating System: {0}\nPattypan Version: {1}",
new String[]{os, Settings.VERSION}
);

Session.WIKI = Wiki.newSession(wiki, scriptPath, protocol);
launch(args);
Expand Down

0 comments on commit 872feec

Please sign in to comment.