question: public void paintBorder ( Component c , Graphics g , int x , int y , int width , int height ) { if ( ! ( c instanceof JPopupMenu ) ) { return ; } Font origFont = g . getFont ( ) ; Color origColor = g . getColor ( ) ; JPopupMenu popup = ( JPopupMenu ) c ; String title = popup . getLabel ( ) ; if ( title == null ) { return ; } g . setFont ( font ) ; FontMetrics fm = SwingUtilities2 . getFontMetrics ( popup , g , font ) ; int fontHeight = fm . getHeight ( ) ; int descent = fm . getDescent ( ) ; int ascent = fm . getAscent ( ) ; Point textLoc = new Point ( ) ; int stringWidth = SwingUtilities2 . stringWidth ( popup , fm , title ) ; textLoc . y = y + ascent + TEXT_SPACING ; textLoc . x = x + ( ( width - stringWidth ) / 2 ) ; g . setColor ( background ) ; g . fillRect ( textLoc . x - TEXT_SPACING , textLoc . y - ( fontHeight - descent ) , stringWidth + ( 2 * TEXT_SPACING ) , fontHeight - descent ) ; g . setColor ( foreground ) ; SwingUtilities2 . drawString ( popup , g , title , textLoc . x , textLoc . y ) ; MotifGraphicsUtils . drawGroove ( g , x , textLoc . y + TEXT_SPACING , width , GROOVE_HEIGHT , shadowColor , highlightColor ) ; g . setFont ( origFont ) ; g . setColor ( origColor ) ; }
target:  Paints the border for the specified component with the specified position and size.