if(comp instanceof JFloatable) { ((JFloatable)comp).setAutoClose(true); ((JFloatable)comp).doUnfloat(); }
  public void start() {    slTracker =       new ServiceTracker(Activator.getTargetBC(), StartLevel.class.getName(), null);    slTracker.open();    pkgTracker =       new ServiceTracker(Activator.getTargetBC(), PackageAdmin.class.getName(), null);    pkgTracker.open();        emptyIcon     = new ImageIcon(getClass().getResource("/empty.gif"));    startIcon     = new ImageIcon(getClass().getResource("/player_play.png"));    stopIcon      = new ImageIcon(getClass().getResource("/player_stop.png"));    uninstallIcon = new ImageIcon(getClass().getResource("/player_eject.png"));    installIcon = new ImageIcon(getClass().getResource("/player_install.png"));    updateIcon    = new ImageIcon(getClass().getResource("/update.png"));    viewIcon      = new ImageIcon(getClass().getResource("/view_select.png"));    magPlusIcon    = new ImageIcon(getClass().getResource("/viewmag+.png"));    magMinusIcon   = new ImageIcon(getClass().getResource("/viewmag-.png"));    magFitIcon     = new ImageIcon(getClass().getResource("/viewmagfit.png"));    mag1to1Icon    = new ImageIcon(getClass().getResource("/viewmag1.png"));    reloadIcon     = new ImageIcon(getClass().getResource("/reload_green.png"));    arrowUpIcon    = new ImageIcon(getClass().getResource("/1uparrow.png"));    arrowUp2Icon   = new ImageIcon(getClass().getResource("/2uparrow.png"));    arrowDownIcon  = new ImageIcon(getClass().getResource("/1downarrow.png"));    arrowDown2Icon = new ImageIcon(getClass().getResource("/2downarrow.png"));    openIcon     = new ImageIcon(getClass().getResource("/open.png"));    openURLIcon  = new ImageIcon(getClass().getResource("/bundle_small.png"));    saveIcon     = new ImageIcon(getClass().getResource("/save.png"));    connectIcon  = new ImageIcon(getClass().getResource("/connect.png"));    connectIconLarge  = new ImageIcon(getClass().getResource("/connect48x48.png"));    prevIcon  = new ImageIcon(getClass().getResource("/player_prev.png"));    nextIcon  = new ImageIcon(getClass().getResource("/player_next.png"));    tipIcon     = new ImageIcon(getClass().getResource("/idea.png"));    floatIcon   = new ImageIcon(getClass().getResource("/float.png"));    lfManager = new LFManager();    lfManager.init();    consoleSwing = new ConsoleSwing(Activator.getBC());    consoleSwing.start();    toolBar       = makeToolBar();    statusBar     = new StatusBar("");    String rName = Activator.remoteHost;    Map    props = Activator.getSystemProperties();    String spid  = (String)props.get("org.osgi.provisioning.spid");    if(spid == null) {      spid = "";    }            frame       = new JFrame(Strings.fmt("frame_title", rName, spid));        frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);    frame.addWindowListener(new WindowAdapter() {	public void windowClosing(WindowEvent e) {	  stopFramework();	}      });            contentPane = frame.getContentPane();        contentPane.setLayout(new BorderLayout());    contentPane.setSize(new Dimension(600, 400));    bundlePanel = new JCardPane();    bundlePanel.setPreferredSize(new Dimension(450, 300));    toolBar       = makeToolBar();        detailPanel   = new JTabbedPane();    detailPanel.setPreferredSize(new Dimension(350, 300));    detailPanel.setTabPlacement(JTabbedPane.BOTTOM);        detailPanel.setBorder(null);    //    displayHTML = new BundleInfoDisplayerHTML(this);        contentPane.add(toolBar,      BorderLayout.NORTH);    contentPane.add(statusBar,    BorderLayout.SOUTH);    splitPaneHoriz = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,				    bundlePanel,				    detailPanel);    splitPaneHoriz.setDividerLocation(bundlePanel.getPreferredSize().width);    splitPaneHoriz.setOneTouchExpandable(false);    JFloatable consoleWrapper =       new JFloatable(consoleSwing.getJComponent(), "Console");    splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT,			       splitPaneHoriz,			       consoleWrapper);    splitPane.setDividerLocation(300);    splitPane.setOneTouchExpandable(false);    contentPane.add(splitPane,  BorderLayout.CENTER);    DropTarget dt =       new DropTarget(contentPane,		     DnDConstants.ACTION_COPY_OR_MOVE, // actions		     this,		     true);    alive = true;    Bundle[]  bl = Activator.getTargetBC().getBundles();    for(int i = 0; i  < bl.length; i++) {      bundleChanged(new BundleEvent(BundleEvent.INSTALLED, bl[i]));    }    if(frameLocation != null) {      frame.setLocation(frameLocation);    }    if(frameSize != null) {      frame.setSize(frameSize);    }    frame.setJMenuBar(menuBar = makeMenuBar());           setRemote(Activator.remoteTracker.getService() != null);    setIcon(frame, "/fish");    frame.pack();    frame.show();    frame.toFront();    String dispFilter1 =       "(&" +       "(" + Constants.OBJECTCLASS + "=" +       SwingBundleDisplayer.class.getName() +       ")" +       "(" + SwingBundleDisplayer.PROP_ISDETAIL + "=false" + ")" +       ")";     String dispFilter =       "(" + Constants.OBJECTCLASS + "=" +       SwingBundleDisplayer.class.getName() +       ")";        try {      dispTracker = 	new ServiceTracker(Activator.getBC(), 			   Activator.getBC().createFilter(dispFilter),			   null)	{	  public Object addingService(ServiceReference sr) {	    SwingBundleDisplayer disp = 	      (SwingBundleDisplayer)super.addingService(sr);	    	    Icon   icon = disp.getSmallIcon();	    String  name = 	      Util.getStringProp(sr,				 SwingBundleDisplayer.PROP_NAME,				 disp.getClass().getName());	    String  desc = 	      Util.getStringProp(sr,				 SwingBundleDisplayer.PROP_DESCRIPTION,				 "");	    	    boolean bDetail    = 	      Util.getBooleanProp(sr,				  SwingBundleDisplayer.PROP_ISDETAIL,				  false);	    	    JComponent comp = disp.createJComponent();	    JFloatable wrapper = new JFloatable(comp, name);	    disp.setBundleSelectionModel(bundleSelModel);	    if(bDetail) {	      detailMap.put(sr, disp);	      detailPanel.addTab(name, icon, wrapper, desc);	    } else {	      displayMap.put(sr, disp);	      	      bundlePanel.addTab(name, comp);	      	      makeViewPopupMenu();	      	      viewMenu = makeViewMenu(viewMenu);	    }	    return disp;	  }	  	  public void removedService(ServiceReference sr, Object service) {	    SwingBundleDisplayer disp = (SwingBundleDisplayer)service;	    String  name = 	      Util.getStringProp(sr,				 SwingBundleDisplayer.PROP_NAME,				 disp.getClass().getName());	    boolean bDetail    = 	      Util.getBooleanProp(sr,				  SwingBundleDisplayer.PROP_ISDETAIL,				  false);	    	    if(bDetail) {	      Component comp = null;	      for(int i = 0; i < detailPanel.getTabCount(); i++) {		if(detailPanel.getTitleAt(i).equals(name)) {		  comp = detailPanel.getComponentAt(i);		}	      }	      	      if(comp != null) {		detailPanel.remove(comp);	      }	      detailMap.remove(sr);	    } else {	      displayMap.remove(sr);	      bundlePanel.removeTab(name);	      makeViewPopupMenu();	      viewMenu = makeViewMenu(viewMenu);	    }	    super.removedService(sr, service);	  }	};      dispTracker.open();    } catch (Exception e) {      Activator.log.error("Failed to create tracker", e);    }            bundleSelModel.addBundleSelectionListener(this);    Activator.getBC().addBundleListener(this);    Activator.getBC().addFrameworkListener(this);    if(Activator.getBC() != Activator.getTargetBC()) {      Activator.getTargetBC().addBundleListener(this);      Activator.getTargetBC().addFrameworkListener(this);    }    consoleSwing.getJComponent().requestFocus();  }