mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-09-27 01:20:43 +00:00
invokelater only the startwork
This commit is contained in:
@@ -151,7 +151,7 @@ public class Main {
|
||||
|
||||
public static void startWork(final String name, final int percent, final Runnable cancelCallback) {
|
||||
working = true;
|
||||
View.execInEventDispatch(new Runnable() {
|
||||
View.execInEventDispatchLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (mainFrame != null) {
|
||||
|
||||
@@ -215,6 +215,18 @@ public class View {
|
||||
}
|
||||
|
||||
public static void execInEventDispatch(Runnable r) {
|
||||
if (SwingUtilities.isEventDispatchThread()) {
|
||||
r.run();
|
||||
} else {
|
||||
try {
|
||||
SwingUtilities.invokeAndWait(r);
|
||||
} catch (InterruptedException | InvocationTargetException ex) {
|
||||
Logger.getLogger(View.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void execInEventDispatchLater(Runnable r) {
|
||||
if (SwingUtilities.isEventDispatchThread()) {
|
||||
r.run();
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user