private Point getPopupLocation ( ) { Dimension popupSize = comboBox . getSize ( ) ; Insets insets = getInsets ( ) ; // reduce the width of the scrollpane by the insets so that the popup // is the same width as the combo box. popupSize . setSize ( popupSize . width - ( insets . right + insets . left ) , getPopupHeightForRowCount ( getMaximumRowCount ( ) ) ) ; Rectangle popupBounds = computePopupBounds ( 0 , comboBox . getBounds ( ) . height , popupSize . width , popupSize . height ) ; Dimension scrollSize = popupBounds . getSize ( ) ; Point popupLocation = popupBounds . getLocation ( ) ; scroller . setMaximumSize ( scrollSize ) ; scroller . setPreferredSize ( scrollSize ) ; scroller . setMinimumSize ( scrollSize ) ; list . revalidate ( ) ; return popupLocation ; }
Calculates the upper left location of the Popup .