question: private void showPopup ( Component source ) { actionSource = source ; actionSource . addComponentListener ( this ) ; if ( actionSource instanceof JToggleButton ) { JToggleButton toggleSource = ( JToggleButton ) actionSource ; toggleSource . setSelected ( true ) ; } containingWindow = SwingUtilities . windowForComponent ( actionSource ) ; containingWindow . addComponentListener ( this ) ; Point position = calculatePosition ( source ) ; popupComponent . setLocation ( position ) ; popupComponent . setVisible ( true ) ; popup = new ContainerPopupDialog ( containingWindow , popupComponent , position ) ; popup . setVisible ( true ) ; popup . requestFocus ( ) ; popupComponent . startTracking ( containingWindow , actionSource ) ; }
target:  Creates the popup, calculates position and sets focus