question: protected Rectangle computePopupBounds ( int px , int py , int pw , int ph ) { Toolkit toolkit = Toolkit . getDefaultToolkit ( ) ; Rectangle screenBounds ; GraphicsConfiguration gc = comboBox . getGraphicsConfiguration ( ) ; Point p = new Point ( ) ; SwingUtilities . convertPointFromScreen ( p , comboBox ) ; if ( gc != null ) { Insets screenInsets = toolkit . getScreenInsets ( gc ) ; screenBounds = gc . getBounds ( ) ; screenBounds . width -= ( screenInsets . left + screenInsets . right ) ; screenBounds . height -= ( screenInsets . top + screenInsets . bottom ) ; screenBounds . x += ( p . x + screenInsets . left ) ; screenBounds . y += ( p . y + screenInsets . top ) ; } else { screenBounds = new Rectangle ( p , toolkit . getScreenSize ( ) ) ; } Rectangle rect = new Rectangle ( px , py , pw , ph ) ; if ( py + ph > screenBounds . y + screenBounds . height && ph < screenBounds . height ) { rect . y = - rect . height ; } return rect ; }
target:  Calculate the placement and size of the popup portion of the combo box based on the combo box location and the enclosing screen bounds. If no transformations are required, then the returned rectangle will have the same values as the parameters.