Little fix when uicontrol has no parent.
Jean-baptiste Silvy [Mon, 18 Aug 2008 14:36:07 +0000 (14:36 +0000)]
scilab/modules/gui/src/java/org/scilab/modules/gui/utils/ScilabSwingUtilities.java

index adf8991..821a0c7 100644 (file)
@@ -40,16 +40,18 @@ public final class ScilabSwingUtilities {
                try {
                        SwingUtilities.invokeAndWait(new Runnable() {
                                public void run() {
-                                       Container parent = componentF.getParent();
-                                       parent.remove(componentF);
                                        componentF.setVisible(false);
-                                       parent.repaint();
+                                       Container parent = componentF.getParent();
+                                       if (parent != null) {
+                                               parent.remove(componentF);
+                                               parent.repaint();
+                                       }
                                }
                        });
                } catch (InterruptedException e) {
                        e.printStackTrace();
                } catch (InvocationTargetException e) {
-                       e.printStackTrace();
+                       e.getCause().printStackTrace();
                }
        }