question: public static void paint3Deffect ( Graphics2D g2D , JComponent c , boolean round , boolean out ) { GradientPaint topPaint = null ; if ( out ) topPaint = new GradientPaint ( 0 , 0 , COL_1TOP , 0 , c . getHeight ( ) / 2 , COL_1END ) ; else topPaint = new GradientPaint ( 0 , 0 , COL_2END , 0 , c . getHeight ( ) / 2 , COL_2TOP ) ; g2D . setPaint ( topPaint ) ; RectangularShape topRec = null ; if ( round ) topRec = new RoundRectangle2D . Float ( 0 , 0 , c . getWidth ( ) , c . getHeight ( ) / 2 , 15 , 15 ) ; else topRec = new Rectangle ( 0 , 0 , c . getWidth ( ) , c . getHeight ( ) / 2 ) ; g2D . fill ( topRec ) ; GradientPaint endPaint = null ; if ( out ) endPaint = new GradientPaint ( 0 , c . getHeight ( ) / 2 , COL_2TOP , 0 , c . getHeight ( ) , COL_2END ) ; else endPaint = new GradientPaint ( 0 , c . getHeight ( ) / 2 , COL_1END , 0 , c . getHeight ( ) , COL_1TOP ) ; g2D . setPaint ( endPaint ) ; RectangularShape endRec = null ; if ( round ) endRec = new RoundRectangle2D . Float ( 0 , c . getHeight ( ) / 2 , c . getWidth ( ) , c . getHeight ( ) / 2 , 15 , 15 ) ; else endRec = new Rectangle ( 0 , c . getHeight ( ) / 2 , c . getWidth ( ) , c . getHeight ( ) / 2 ) ; g2D . fill ( endRec ) ; }
target:  Paint 3D effect in (lighten in upper half, darken in lowerhalf) (called from paint methods)