Board index » jbuilder » Assign an image as Backgroud

Assign an image as Backgroud


2004-06-02 04:39:49 PM
jbuilder11
Hi,
I'm new of Jbuilder
I downloaded Jbuilder X Foundation and I Like create an image editor.
Isn't impossible insert an image as background.
Can someone help me please ?
Thank you
 
 

Re:Assign an image as Backgroud

"Fabrizio Farina" < XXXX@XXXXX.COM >writes:
Quote
Isn't impossible insert an image as background.
Can someone help me please ?
You can override your component's paintComponent() method to draw the
image before calling super.paintComponent().
For tiling of image as background, look at the java.awt.TexturePaint
class.
 

Re:Assign an image as Backgroud

The way I do it is something like --
public void paintComponent(Graphics g)
{
super.paintComponent(g);
if(image == null)
{
System.err.println("Image == null...");
return;
}
while(!g.drawImage(image,0,0,this.getWidth(), this.getHeight(),this));
}
Tor Iver Wilhelmsen (TeamB) wrote:
Quote
"Fabrizio Farina" < XXXX@XXXXX.COM >writes:


>Isn't impossible insert an image as background.
>Can someone help me please ?


You can override your component's paintComponent() method to draw the
image before calling super.paintComponent().

For tiling of image as background, look at the java.awt.TexturePaint
class.
 

{smallsort}