Swing labs has a neat pinstripe painter which would fit the bill. It's really simple to use.
public class SomePanel extends JXPanel{
JXPanel(){
PinstripePainter pinstripe1 = new PinstripePainter( new Color( 255, 255, 255, 80 ), 0.0 );
pinstripe1.setSpacing( 5 );
pinstripe1.setStripeWidth(2);
PinstripePainter pinstripe2 = new PinstripePainter( new Color( 255, 255, 255, 80 ), 45.0 );
pinstripe2.setSpacing( 5 );
pinstripe2.setStripeWidth(2);
this.setBackgroundPainter( new CompoundPainter( pinstripe1, pinstripe2 ) );
}
http://swinglabs.org/index.jsp
rendering image is an simple option but I have a restriction of not using this. I have to achieve it using some other method. TexturePaint class give me similar looks but not exact one
...?
I'm not talking about rendering what you want as an image. You create an image which is used by TexturePaint. eg to create a diagonal grid you might create a 5x5 grid and render an 'X' on it like this,
##
-#-#-
--#--
-#-#-
##
Then when you render anything using that paint, this will be tiled onto the shape.
If you want to do it another way, take the shape you're trying to draw and use it as the clip for the Graphics2D object, and then just paint whatever you want over it.