Graphics2D g2 = (Graphics2D)g;
// Create a round rectangle.
RoundRectangle2D r = new RoundRectangle2D.Float(25, 35, 150, 150, 25, 25);
// Create a texture rectangle the same size as the texture image.
Rectangle2D tr = new Rectangle2D.Double(0, 0,
mImage.getWidth(), mImage.getHeight());
// Create the TexturePaint.
TexturePaint tp = new TexturePaint(mImage, tr);
// Now fill the round rectangle.
g2.setPaint(tp);
g2.fill(r);