reduce depth search to find figure during closing
[scilab.git] / scilab / modules / gui / src / java / org / scilab / modules / gui / bridge / tab / SwingScilabCommonPanel.java
index 256660b..77b8287 100644 (file)
@@ -1,21 +1,27 @@
 /*
  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
  * Copyright (C) 2014 - Scilab Enterprises - Bruno JOFRET
+ * Copyright (C) 2015 - Scilab Enterprises - Anais AUBERT
  *
- * This file must be used under the terms of the CeCILL.
- * This source file is licensed as described in the file COPYING, which
- * you should have received as part of this distribution.  The terms
- * are also available at
- * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+ * Copyright (C) 2012 - 2016 - Scilab Enterprises
+ *
+ * This file is hereby licensed under the terms of the GNU GPL v2.0,
+ * pursuant to article 5.3.4 of the CeCILL v.2.1.
+ * This file was originally licensed under the terms of the CeCILL v2.1,
+ * and continues to be available under such terms.
+ * For more information, see the COPYING file which you should have received
+ * along with this program.
  *
  */
 package org.scilab.modules.gui.bridge.tab;
 
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_AUTORESIZE__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_AXES_SIZE__;
+import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_BACKGROUND__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_BORDER_OPT_PADDING__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_CALLBACK__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_CHILDREN__;
+import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_COLORMAP__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_EVENTHANDLER_ENABLE__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_EVENTHANDLER_NAME__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_GRID_OPT_GRID__;
@@ -44,13 +50,13 @@ import java.awt.Dimension;
 import java.awt.GridBagConstraints;
 import java.awt.GridBagLayout;
 import java.awt.GridLayout;
+import java.awt.Insets;
 import java.awt.image.BufferedImage;
 import java.io.File;
 import java.io.IOException;
 
 import javax.imageio.ImageIO;
 import javax.swing.ImageIcon;
-import javax.swing.JLayeredPane;
 
 import org.scilab.modules.commons.gui.FindIconHelper;
 import org.scilab.modules.graphic_objects.figure.Figure;
@@ -69,6 +75,7 @@ import org.scilab.modules.gui.toolbar.ToolBar;
 import org.scilab.modules.gui.utils.Position;
 import org.scilab.modules.gui.utils.Size;
 import org.scilab.modules.gui.utils.ToolBarBuilder;
+import org.scilab.modules.renderer.JoGLView.util.ColorFactory;
 
 public class SwingScilabCommonPanel {
 
@@ -78,18 +85,19 @@ public class SwingScilabCommonPanel {
      * Update the tab after a modification of its properties
      * @param property the property name
      * @param value the property value
-     * @see org.scilab.modules.gui.SwingViewObject#update(java.lang.String, java.lang.Object)
+     * @see org.scilab.modules.gui.SwingViewObject#update(java.lang.String,
+     * java.lang.Object)
      */
     protected static void update(SwingScilabPanel component, int property, Object value) {
         String name;
         Integer figureId;
         switch (property) {
-            case  __GO_NAME__ :
+            case __GO_NAME__:
                 name = ((String) value);
                 figureId = (Integer) GraphicController.getController().getProperty(component.getId(), __GO_ID__);
                 updateTitle(component, name, figureId);
                 break;
-            case __GO_ID__ :
+            case __GO_ID__:
                 /* Update title */
                 figureId = ((Integer) value);
                 Figure localFigure = (Figure) GraphicController.getController().getObjectFromId(component.getId());
@@ -99,111 +107,162 @@ public class SwingScilabCommonPanel {
                 /** Update tool bar */
                 if (localFigure.getToolbarAsEnum() == BarType.FIGURE) {
                     SwingScilabWindow parentWindow = SwingScilabWindow.allScilabWindows.get(component.getParentWindowId());
+
+                    boolean currentVisible = component.getToolBar().isVisible();
+
+                    //only if toolbar is visible
+                    if (currentVisible) {
+                        //keep current delta between figure size and axes size
+                        component.storeSizeDelta();
+                    }
+
                     ToolBar toolbar = ToolBarBuilder.buildToolBar(GRAPHICS_TOOLBAR_DESCRIPTOR, figureId);
-                    toolbar.setVisible(localFigure.getToolbarVisible());
+                    toolbar.setVisible(currentVisible);
                     component.setToolBar(toolbar);
                     parentWindow.addToolBar(toolbar);
+                    //force redraw to get good value on contentpane.getHeight
+                    parentWindow.validate();
+
+                    if (currentVisible) {
+                        //apply stored delta to new axes size
+                        component.applyDeltaSize();
+                    }
                 }
 
                 /* Update callback */
-                String closingCommand =
-                    "if (get_figure_handle(" + figureId + ") <> []) then"
-                    +      "  if (get(get_figure_handle(" + figureId + "), 'event_handler_enable') == 'on') then"
-                    +      "    execstr(get(get_figure_handle(" + figureId + "), 'event_handler')+'(" + figureId + ", -1, -1, -1000)', 'errcatch', 'm');"
-                    +      "  end;"
-                    +      "  delete(get_figure_handle(" + figureId + "));"
-                    +      "end;";
+                String closingCommand =   "%closing_fig = findobj('figure_id', " + figureId + ", '-flat');"
+                                        + "if (%closing_fig <> []) then"
+                                        + "    if (get(%closing_fig, 'event_handler_enable') == 'on') then"
+                                        + "        execstr(get(%closing_fig, 'event_handler')+'(" + figureId + ", -1, -1, -1000)', 'errcatch', 'm');"
+                                        + "    end;"
+                                        + "    delete(%closing_fig);"
+                                        + "end;"
+                                        + "clear('%closing_fig');";
+
                 component.setCallback(null);
                 component.setCallback(ScilabCloseCallBack.create(component.getId(), closingCommand));
                 /* Update menus callback */
                 Integer[] children = (Integer[]) GraphicController.getController().getProperty(component.getId(), __GO_CHILDREN__);
                 updateChildrenCallbacks(children, figureId);
                 break;
-            case __GO_SIZE__ :
+            case __GO_SIZE__: {
                 Integer[] size = (Integer[]) value;
                 SwingScilabWindow figure = SwingScilabWindow.allScilabWindows.get(component.getParentWindowId());
                 Size oldFigureSize = figure.getDims();
-                figure.setDims(new Size(size[0], size[1]));
-                int deltaFigureX = size[0] - oldFigureSize.getWidth();
-                int deltaFigureY = size[1] - oldFigureSize.getHeight();
-                if ( oldFigureSize.getWidth() != 0 && oldFigureSize.getHeight() != 0
-                        && ((oldFigureSize.getWidth() != size[0]) || (oldFigureSize.getHeight() != size[1]))
-                        && ((Boolean) GraphicController.getController().getProperty(component.getId(), __GO_AUTORESIZE__))
-                   ) {
-                    Integer[] axesSize = (Integer[]) GraphicController.getController().getProperty(component.getId(), __GO_AXES_SIZE__);
-                    Integer[] newAxesSize = {axesSize[0] + deltaFigureX, axesSize[1] + deltaFigureY};
-                    GraphicController.getController().setProperty(component.getId(), __GO_AXES_SIZE__, newAxesSize);
+
+                if (oldFigureSize.getWidth() != 0 && oldFigureSize.getHeight() != 0 && ((oldFigureSize.getWidth() != size[0]) || (oldFigureSize.getHeight() != size[1]))
+                        && ((Boolean) GraphicController.getController().getProperty(component.getId(), __GO_AUTORESIZE__))) {
+                    figure.setDims(new Size(size[0], size[1]));
+                    figure.validate();
+                    // Axes are resized by resize event: SwingScilabDockablePanel::componentResized or SwingScilabStaticPanel::componentResized
+                    // ==> NO NEED TO FORCE RESIZE
+                    // GraphicController.getController().setProperty(component.getId(), __GO_AXES_SIZE__, new Integer[] { figure.getContentPane().getWidth(), figure.getContentPane().getHeight() });
+
                 }
                 break;
-            case __GO_POSITION__ :
+            }
+            case __GO_POSITION__:
                 Integer[] position = (Integer[]) value;
                 SwingScilabWindow.allScilabWindows.get(component.getParentWindowId()).setPosition(new Position(position[0], position[1]));
                 break;
-            case __GO_AXES_SIZE__ :
+            case __GO_AXES_SIZE__:
                 Integer[] axesSize = (Integer[]) value;
                 Dimension oldAxesSize = component.getContentPane().getSize();
-                if ( oldAxesSize.getWidth() != 0 && oldAxesSize.getHeight() != 0
-                        && ((oldAxesSize.getWidth() != axesSize[0]) || (oldAxesSize.getHeight() != axesSize[1]))
-                        && ((Boolean) GraphicController.getController().getProperty(component.getId(), __GO_AUTORESIZE__))
-                   ) {
+                if (oldAxesSize.getWidth() != 0 && oldAxesSize.getHeight() != 0 && ((oldAxesSize.getWidth() != axesSize[0]) || (oldAxesSize.getHeight() != axesSize[1]))
+                        && ((Boolean) GraphicController.getController().getProperty(component.getId(), __GO_AUTORESIZE__))) {
                     // TODO manage tabs when there are docked (do not change the window size if more than one tab docked)
                     int deltaX = axesSize[0] - (int) oldAxesSize.getWidth();
                     int deltaY = axesSize[1] - (int) oldAxesSize.getHeight();
                     Size parentWindowSize = SwingScilabWindow.allScilabWindows.get(component.getParentWindowId()).getDims();
-                    SwingScilabWindow.allScilabWindows.get(component.getParentWindowId()).setDims(
-                        new Size(parentWindowSize.getWidth() + deltaX, parentWindowSize.getHeight() + deltaY));
-                    Integer figureSize[] = {parentWindowSize.getWidth() + deltaX, parentWindowSize.getHeight() + deltaY};
-                    GraphicController.getController().setProperty(component.getId(), __GO_SIZE__, figureSize);
+                    SwingScilabWindow.allScilabWindows.get(component.getParentWindowId()).setDims(new Size(parentWindowSize.getWidth() + deltaX, parentWindowSize.getHeight() + deltaY));
+                    GraphicController.getController().setProperty(component.getId(), __GO_SIZE__, new Integer[] { parentWindowSize.getWidth() + deltaX, parentWindowSize.getHeight() + deltaY});
                 }
                 break;
-            case __GO_INFO_MESSAGE__ :
+            case __GO_INFO_MESSAGE__:
                 if (component.getInfoBar() != null) {
                     component.getInfoBar().setText((String) value);
                 }
                 break;
-            case __GO_EVENTHANDLER_ENABLE__ :
+            case __GO_EVENTHANDLER_ENABLE__:
                 Boolean enabled = (Boolean) GraphicController.getController().getProperty(component.getId(), __GO_EVENTHANDLER_ENABLE__);
-                component. setEventHandlerEnabled(enabled);
+                component.setEventHandlerEnabled(enabled);
                 break;
-            case __GO_EVENTHANDLER_NAME__ :
+            case __GO_EVENTHANDLER_NAME__:
                 String eventHandlerName = (String) GraphicController.getController().getProperty(component.getId(), __GO_EVENTHANDLER_NAME__);
                 component.setEventHandler(eventHandlerName);
                 break;
-            case __GO_VISIBLE__ :
+            case __GO_VISIBLE__:
                 component.getContentPane().setVisible((Boolean) value);
                 if (component.getParentWindow().getNbDockedObjects() == 1) {
                     component.getParentWindow().setVisible((Boolean) value);
                 }
+
+                //de-iconify windows
+                if((Boolean)value == true) {
+                    int state = component.getParentWindow().getExtendedState();
+                    if((state & SwingScilabWindow.ICONIFIED) == SwingScilabWindow.ICONIFIED) {
+                        component.getParentWindow().setExtendedState(state - SwingScilabWindow.ICONIFIED);
+                    }
+                }
                 break;
-            case __GO_INFOBAR_VISIBLE__ :
+            case __GO_INFOBAR_VISIBLE__: {
+                component.disableResizeEvent();
+                Integer[] oldSize = (Integer[]) GraphicController.getController().getProperty(component.getId(), __GO_AXES_SIZE__);
                 component.getInfoBar().setVisible((Boolean) value);
+                SwingScilabWindow parentWindow = SwingScilabWindow.allScilabWindows.get(component.getParentWindowId());
+                parentWindow.validate();
+                GraphicController.getController().setProperty(component.getId(), __GO_AXES_SIZE__, oldSize);
+                component.enableResizeEvent();
                 break;
-            case __GO_TOOLBAR_VISIBLE__ :
+            }
+            case __GO_TOOLBAR_VISIBLE__: {
+                component.disableResizeEvent();
+                Integer[] oldSize = (Integer[]) GraphicController.getController().getProperty(component.getId(), __GO_AXES_SIZE__);
                 component.getToolBar().setVisible((Boolean) value);
+                SwingScilabWindow parentWindow = SwingScilabWindow.allScilabWindows.get(component.getParentWindowId());
+                parentWindow.validate();
+                GraphicController.getController().setProperty(component.getId(), __GO_AXES_SIZE__, oldSize);
+                component.enableResizeEvent();
                 break;
-            case __GO_MENUBAR_VISIBLE__ :
+            }
+            case __GO_MENUBAR_VISIBLE__: {
+                component.disableResizeEvent();
+                Integer[] oldSize = (Integer[]) GraphicController.getController().getProperty(component.getId(), __GO_AXES_SIZE__);
                 component.getMenuBar().setVisible((Boolean) value);
+                SwingScilabWindow parentWindow = SwingScilabWindow.allScilabWindows.get(component.getParentWindowId());
+                parentWindow.validate();
+                GraphicController.getController().setProperty(component.getId(), __GO_AXES_SIZE__, oldSize);
+                component.enableResizeEvent();
                 break;
-            case __GO_RESIZE__ :
+            }
+            case __GO_RESIZE__:
                 component.getParentWindow().setResizable((Boolean) value);
+                //on some cases, set resizable can change frame size. ( L&F, Window Manager, ... )
+                //so force set of axes_size.
+                SwingScilabCommonPanel.update(component, __GO_AXES_SIZE__, GraphicController.getController().getProperty(component.getId(), __GO_AXES_SIZE__));
+
                 break;
-            case __GO_LAYOUT__ :
+            case __GO_LAYOUT__:
                 LayoutType newLayout = LayoutType.intToEnum((Integer) value);
+
+                component.getWidgetPane().invalidate();
+
                 switch (newLayout) {
-                    case BORDER : {
+                    case BORDER: {
                         Integer[] padding = (Integer[]) GraphicController.getController().getProperty(component.getId(), __GO_BORDER_OPT_PADDING__);
                         component.getWidgetPane().setLayout(new BorderLayout(padding[0], padding[1]));
-                        component.getWidgetPane().setLayout(new BorderLayout());
+                        component.setHasLayout(true);
                         break;
                     }
-                    case GRIDBAG : {
+                    case GRIDBAG: {
                         component.getWidgetPane().setLayout(new GridBagLayout());
+                        component.setHasLayout(true);
                         break;
                     }
-                    case GRID : {
+                    case GRID: {
                         Integer[] padding = (Integer[]) GraphicController.getController().getProperty(component.getId(), __GO_GRID_OPT_PADDING__);
                         Integer[] grid = (Integer[]) GraphicController.getController().getProperty(component.getId(), __GO_GRID_OPT_GRID__);
-                        Integer[] localGrid = new Integer[] {0, 0};
+                        Integer[] localGrid = new Integer[] { 0, 0 };
                         localGrid[0] = grid[0];
                         localGrid[1] = grid[1];
 
@@ -212,16 +271,21 @@ public class SwingScilabCommonPanel {
                         }
 
                         component.getWidgetPane().setLayout(new GridLayout(localGrid[0], localGrid[1], padding[0], padding[1]));
+                        component.setHasLayout(true);
                         break;
                     }
-                    case NONE :
+                    case NONE:
                     default:
                         component.getWidgetPane().setLayout(null);
+                        component.setHasLayout(false);
                         break;
                 }
+
+                component.getWidgetPane().validate();
+
                 break;
-            case __GO_GRID_OPT_PADDING__ :
-            case __GO_GRID_OPT_GRID__ : {
+            case __GO_GRID_OPT_PADDING__:
+            case __GO_GRID_OPT_GRID__: {
                 Integer layout = (Integer) GraphicController.getController().getProperty(component.getId(), __GO_LAYOUT__);
                 LayoutType layoutType = LayoutType.intToEnum(layout);
 
@@ -232,7 +296,7 @@ public class SwingScilabCommonPanel {
                 Integer[] padding = (Integer[]) GraphicController.getController().getProperty(component.getId(), __GO_GRID_OPT_PADDING__);
 
                 Integer[] grid = (Integer[]) GraphicController.getController().getProperty(component.getId(), __GO_GRID_OPT_GRID__);
-                Integer[] localGrid = new Integer[] {0, 0};
+                Integer[] localGrid = new Integer[] { 0, 0 };
                 localGrid[0] = grid[0];
                 localGrid[1] = grid[1];
 
@@ -240,10 +304,19 @@ public class SwingScilabCommonPanel {
                     localGrid[0] = 1;
                 }
 
-                component.getWidgetPane().setLayout(new GridLayout(localGrid[0], localGrid[1], padding[0], padding[1]));
+                component.getWidgetPane().invalidate();
+
+                GridLayout gl = (GridLayout)component.getWidgetPane().getLayout();
+                gl.setRows(localGrid[0]);
+                gl.setColumns(localGrid[1]);
+                gl.setHgap(padding[0]);
+                gl.setVgap(padding[1]);
+
+                component.getWidgetPane().validate();
+
                 break;
             }
-            case __GO_BORDER_OPT_PADDING__ : {
+            case __GO_BORDER_OPT_PADDING__: {
                 Integer layout = (Integer) GraphicController.getController().getProperty(component.getId(), __GO_LAYOUT__);
                 LayoutType layoutType = LayoutType.intToEnum(layout);
 
@@ -251,15 +324,22 @@ public class SwingScilabCommonPanel {
                     break;
                 }
 
-                Integer[] padding = (Integer[]) GraphicController.getController().getProperty(component.getId(), __GO_BORDER_OPT_PADDING__);
-                component.getWidgetPane().setLayout(new BorderLayout(padding[0], padding[1]));
-                component.getWidgetPane().setLayout(new BorderLayout());
+                component.getWidgetPane().invalidate();
+
+                Integer[] padding = (Integer[])value;
+                BorderLayout bl = (BorderLayout)component.getWidgetPane().getLayout();
+                bl.setHgap(padding[0]);
+                bl.setVgap(padding[1]);
+
+
+                component.getWidgetPane().validate();
+
                 break;
             }
-            case __GO_UI_ICON__ : {
-                File file = new File((String)value);
+            case __GO_UI_ICON__: {
+                File file = new File((String) value);
                 if (file.exists() == false) {
-                    String filename = FindIconHelper.findImage((String)value);
+                    String filename = FindIconHelper.findImage((String) value);
                     file = new File(filename);
                 }
 
@@ -270,6 +350,17 @@ public class SwingScilabCommonPanel {
                 }
                 break;
             }
+            case __GO_COLORMAP__: {
+                // Force background
+                Figure figure = (Figure) GraphicController.getController().getObjectFromId(component.getId());
+                component.setFigureBackground(ColorFactory.createColor(figure.getColorMap(), figure.getBackground()));
+                break;
+            }
+            case __GO_BACKGROUND__: {
+                Figure figure = (Figure) GraphicController.getController().getObjectFromId(component.getId());
+                component.setFigureBackground(ColorFactory.createColor(figure.getColorMap(), (Integer) value));
+                break;
+            }
         }
     }
 
@@ -293,11 +384,7 @@ public class SwingScilabCommonPanel {
     private static void updateChildrenCallbacks(Integer[] children, int parentFigureId) {
         for (int kChild = 0; kChild < children.length; kChild++) {
             Integer childType = (Integer) GraphicController.getController().getProperty(children[kChild], __GO_TYPE__);
-            if (childType != null && (
-                        childType == __GO_UIMENU__
-                        || childType == __GO_UIPARENTMENU__
-                        || childType == __GO_UICHILDMENU__
-                        || childType == __GO_UICHECKEDMENU__)) {
+            if (childType != null && (childType == __GO_UIMENU__ || childType == __GO_UIPARENTMENU__ || childType == __GO_UICHILDMENU__ || childType == __GO_UICHECKEDMENU__)) {
                 String cb = (String) GraphicController.getController().getProperty(children[kChild], __GO_CALLBACK__);
                 SwingView.getFromId(children[kChild]).update(__GO_CALLBACK__, replaceFigureID(cb, parentFigureId));
                 Integer[] menuChildren = (Integer[]) GraphicController.getController().getProperty(children[kChild], __GO_CHILDREN__);
@@ -317,7 +404,8 @@ public class SwingScilabCommonPanel {
     }
 
     /**
-     * Add a SwingViewObject (from SwingView.java) to container and returns its index
+     * Add a SwingViewObject (from SwingView.java) to container and returns its
+     * index
      * @param member the member to add
      */
     protected static void addMember(SwingScilabPanel component, SwingViewObject member) {
@@ -365,39 +453,39 @@ public class SwingScilabCommonPanel {
 
             // Anchor
             switch (uicontrol.getGridBagAnchorAsEnum()) {
-                case LEFT :
+                case RIGHT:
                     constraints.anchor = GridBagConstraints.EAST;
                     break;
-                case UPPER :
+                case UPPER:
                     constraints.anchor = GridBagConstraints.NORTH;
                     break;
                 case LOWER:
                     constraints.anchor = GridBagConstraints.SOUTH;
                     break;
-                case LOWER_LEFT:
+                case LOWER_RIGHT:
                     constraints.anchor = GridBagConstraints.SOUTHEAST;
                     break;
-                case LOWER_RIGHT:
+                case LOWER_LEFT:
                     constraints.anchor = GridBagConstraints.SOUTHWEST;
                     break;
-                case RIGHT:
+                case LEFT:
                     constraints.anchor = GridBagConstraints.WEST;
                     break;
-                case UPPER_LEFT:
+                case UPPER_RIGHT:
                     constraints.anchor = GridBagConstraints.NORTHEAST;
                     break;
-                case UPPER_RIGHT:
+                case UPPER_LEFT:
                     constraints.anchor = GridBagConstraints.NORTHWEST;
                     break;
-                case CENTER :
-                default :
+                case CENTER:
+                default:
                     constraints.anchor = GridBagConstraints.CENTER;
                     break;
             }
 
             // Fill
             switch (uicontrol.getGridBagFillAsEnum()) {
-                case BOTH :
+                case BOTH:
                     constraints.fill = GridBagConstraints.BOTH;
                     break;
                 case HORIZONTAL:
@@ -413,7 +501,8 @@ public class SwingScilabCommonPanel {
             }
 
             // Insets
-            // TODO : add Insets
+            Double[] margins = uicontrol.getMargins();
+            constraints.insets = new Insets(margins[0].intValue(), margins[1].intValue(), margins[2].intValue(), margins[3].intValue());
 
             // Padding
             Integer[] padding = uicontrol.getGridBagPadding();
@@ -429,14 +518,14 @@ public class SwingScilabCommonPanel {
             component.getWidgetPane().revalidate();
         } else {
             if (member instanceof SwingScilabScrollableFrame || member instanceof SwingScilabFrame) {
-                component.getWidgetPane().add((Component) member, JLayeredPane.FRAME_CONTENT_LAYER);
+                component.getWidgetPane().add((Component) member, 0);
             } else {
-                component.getWidgetPane().add((Component) member, JLayeredPane.DEFAULT_LAYER + 1);
+                component.getWidgetPane().add((Component) member, 0);
             }
         }
     }
 
-    protected static void  removeMember(SwingScilabPanel component, SwingViewObject member) {
+    protected static void removeMember(SwingScilabPanel component, SwingViewObject member) {
         component.getWidgetPane().remove((Component) member);
     }
 }