Tuesday, October 5, 2010

Textures as custom backgrounds

Just another short post about custom backgrounds. 
In my last post i forgot to mention that you could also use textures as backgrounds for your gauges.
Because the background has to be of type java.awt.Paint, it could also be a java.awt.TexturePaint.

With the right textures at your hand you could do things like this...

Here is the code that you need to achieve things like that...

// Create a gauge
final Radial4 RADIAL = new Radial4();

// Definition of the image file you'll use

// Load the image file to a buffered image
final BufferedImage IMAGE = ImageIO.read(IMAGE_NAME));

// Create the texture paint from your image
final TexturePaint TEXTURE = new TexturePaint(IMAGE, RADIAL.getBounds2D());

// Set the texturepaint as background of your gauge

// Activate custom backgrounds for your gauge

So now it's up to you...

No comments:

Post a Comment