/** Initializes the button. */ private void initButtons() { final IconManager iconManager = serviceRegistrar.getService(IconManager.class); // Create Float / Dock Button floatButton = new JButton(ICON_SQUARE_O); floatButton.setToolTipText(TOOL_TIP_FLOAT); CytoPanelUtil.styleButton(floatButton); floatButton.setFont(iconManager.getIconFont(12)); floatButton.setSelected(true); // Create close button closeButton = new JButton(ICON_REMOVE); closeButton.setToolTipText(TOOL_TIP_CLOSE); CytoPanelUtil.styleButton(closeButton); closeButton.setFont(iconManager.getIconFont(13)); closeButton.setSelected(true); floatButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { if (isFloating()) DockCytoPanel(); else FloatCytoPanel(); notifyListeners(NOTIFICATION_STATE_CHANGE); } }); closeButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { setState(CytoPanelState.HIDE); notifyListeners(NOTIFICATION_STATE_CHANGE); } }); }
/** * Sets the Location of the External Window. * * @param externalWindow ExternalWindow Object. */ private void setLocationOfExternalWindow(Window externalWindow) { Toolkit tk = Toolkit.getDefaultToolkit(); Dimension screenDimension = tk.getScreenSize(); // Get Absolute Location and Bounds, relative to Screen Rectangle containerBounds = cytoPanelContainer.getBounds(); containerBounds.setLocation(cytoPanelContainer.getLocationOnScreen()); Point p = CytoPanelUtil.getLocationOfExternalWindow( screenDimension, containerBounds, externalWindow.getSize(), compassDirection, false); externalWindow.setLocation(p); externalWindow.setVisible(true); }