int w2 = w/2;
int h2 = h/2;
g2.setPaint(new GradientPaint(0,0,outerC,w*.35f,h*.35f,innerC));
g2.fillRect(0, 0, w2, h2);
g2.setPaint(new GradientPaint(w,0,outerC,w*.65f,h*.35f,innerC));
g2.fillRect(w2, 0, w2, h2);
g2.setPaint(new GradientPaint(0,h,outerC,w*.35f,h*.65f,innerC));
g2.fillRect(0, h2, w2, h2);
g2.setPaint(new GradientPaint(w,h,outerC,w*.65f,h*.65f,innerC));
g2.fillRect(w2, h2, w2, h2);
g2.setColor(Color.black);
TextLayout tl = new TextLayout(
"GradientPaint", g2.getFont(), g2.getFontRenderContext());
tl.draw(g2, (int) (w/2-tl.getBounds().getWidth()/2),
(int) (h/2+tl.getBounds().getHeight()/2));