Author: bobtarling
Date: 2009-12-11 15:51:31-0800
New Revision: 17649

Modified:
   trunk/src/argouml-app/src/org/argouml/uml/ui/TabProps.java

Log:
Remove the current panel when its done with

Modified: trunk/src/argouml-app/src/org/argouml/uml/ui/TabProps.java
Url: 
http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/ui/TabProps.java?view=diff&pathrev=17649&r1=17648&r2=17649
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/ui/TabProps.java  (original)
+++ trunk/src/argouml-app/src/org/argouml/uml/ui/TabProps.java  2009-12-11 
15:51:31-0800
@@ -77,6 +77,11 @@
     private JPanel lastPanel;
     private String panelClassBaseName = "";
 
+    /**
+     * The panel currently displayed in center
+     */
+    private JPanel currentPanel;
+    
     private Object target;
 
     /**
@@ -204,20 +209,24 @@
             repaint();
             lastPanel = blankPanel;
         } else {
-            JPanel newPanel = null;
-            newPanel = findPanelFor(target);
+            JPanel newPanel = findPanelFor(target);
             if (newPanel != null && newPanel instanceof TabModelTarget) {
                 addTargetListener((TabModelTarget) newPanel);
             }
-            if (newPanel instanceof JPanel) {
-                add((JPanel) newPanel, BorderLayout.CENTER);
-                lastPanel = (JPanel) newPanel;
+            
+            if (currentPanel != null) {
+                remove(currentPanel);
+                currentPanel = null;
+            }
+            if (newPanel != null) {
+                currentPanel = newPanel;
             } else {
-                add(blankPanel, BorderLayout.CENTER);
-                validate();
-                repaint();
+                currentPanel = blankPanel;
                 lastPanel = blankPanel;
             }
+            add(currentPanel);
+            validate();
+            repaint();
         }
     }

------------------------------------------------------
http://argouml.tigris.org/ds/viewMessage.do?dsForumId=5905&dsMessageId=2429889

To unsubscribe from this discussion, e-mail: 
[[email protected]].

Reply via email to