diff --git a/src/main/java/ai/nets/samj/gui/MainGUI.java b/src/main/java/ai/nets/samj/gui/MainGUI.java index 3eb272e..21250d9 100644 --- a/src/main/java/ai/nets/samj/gui/MainGUI.java +++ b/src/main/java/ai/nets/samj/gui/MainGUI.java @@ -142,10 +142,11 @@ public void windowClosed(WindowEvent e) { drawerPanel.setVisible(false); this.setTwoThirdsEnabled(false); - if (this.cmbModels.getSelectedModel().isInstalled() && cmbImages.getSelectedObject() != null) - go.setEnabled(true); - else - go.setEnabled(false); + go.setEnabled(false); + new Thread(() -> { + if (this.cmbModels.getSelectedModel().isInstalled() && cmbImages.getSelectedObject() != null) + SwingUtilities.invokeLater(() -> go.setEnabled(true)); + }).start(); // Make the frame visible setVisible(true); } @@ -454,9 +455,12 @@ public void setGUIEnabled(boolean enabled) { cmbModels.setEnabled(enabled); cmbImages.setEnabled(enabled); if (!enabled) { - MainGUI.this.setTwoThirdsEnabled(enabled); - } else if (cmbModels.getSelectedModel().isInstalled() && cmbImages.getSelectedObject() != null) { - go.setEnabled(enabled); + setTwoThirdsEnabled(enabled); + } else if (enabled && cmbImages.getSelectedObject() != null) { + new Thread(() -> { + if (cmbModels.getSelectedModel().isInstalled()) + SwingUtilities.invokeLater(() -> go.setEnabled(true)); + }).start(); } } }; diff --git a/src/main/java/ai/nets/samj/gui/components/ModelDrawerPanel.java b/src/main/java/ai/nets/samj/gui/components/ModelDrawerPanel.java index 4eb7c2f..325a52c 100644 --- a/src/main/java/ai/nets/samj/gui/components/ModelDrawerPanel.java +++ b/src/main/java/ai/nets/samj/gui/components/ModelDrawerPanel.java @@ -110,7 +110,10 @@ private void setTitle(String title) { private void setInfo() { html.clear(); - html.append("p", model.getDescription()); + new Thread(() -> { + String description = model.getDescription(); + SwingUtilities.invokeLater(() -> html.append("p", description)); + }).start(); } @Override