Skip to content

Commit

Permalink
run in javafx thread
Browse files Browse the repository at this point in the history
  • Loading branch information
ValentinHerrmann committed Feb 25, 2025
1 parent b9bda2a commit 67d6227
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion BlueJCode/CodeHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import BlueJCode.Blockly.BlocklyHandler;
import bluej.extensions2.BClass;
import bluej.extensions2.PackageNotFoundException;
import bluej.extensions2.ProjectNotOpenException;
import bluej.extensions2.editor.JavaEditor;
import org.apache.velocity.runtime.directive.Block;

Expand Down Expand Up @@ -129,7 +131,23 @@ public void writeJavaCodeToFile(String code)
editor.loadFile();
editor.getBClass().compile(true);
Logging.log("Window: "+editor.getBClass().getPackage().getWindow().getTitle());
editor.getBClass().getPackage().getWindow().requestFocus();

//editor.getBClass().getPackage().getWindow().requestFocus();
javafx.application.Platform.runLater(() ->
{
try
{
editor.getBClass().getPackage().getWindow().requestFocus();
}
catch (ProjectNotOpenException e)
{
throw new RuntimeException(e);
}
catch (PackageNotFoundException e)
{
throw new RuntimeException(e);
}
});


Logging.log("<<< CodeHandler.writeJavaCodeToFile()");
Expand Down

0 comments on commit 67d6227

Please sign in to comment.