> Hi all :
>
[quoted text clipped - 7 lines]
>
> thanks
You will have to subclass JToolbar and in the paintComponent() method,
display the image.
Something like:
Image myImage = [load image from somewhere];
public void paintComponent (Graphics g)
{
g.drawImage(myImage, 0, 0, this);
}
Not sure what you mean by JToolmenu. Do you mean JMenu or JMenuBar? If so,
you can try the same technique with them.

Signature
Bill Tschumy
Otherwise -- Austin, TX
http://www.otherwise.com
Pedro Silva - 17 Jun 2005 12:47 GMT
Yes ... thats it :-)
(JMenu)
As you see ... noob guy in Java :-S
Thanks ;-)
>>Hi all :
>>
[quoted text clipped - 22 lines]
> Not sure what you mean by JToolmenu. Do you mean JMenu or JMenuBar? If so,
> you can try the same technique with them.
Pedro Silva - 17 Jun 2005 16:01 GMT
do you mean like this ?
It just puts a black stripe in 0,0 and the JMenuBar under it :-(
what am I doing wrong ?
*******************************************
import javax.swing.* ;
import java.awt.* ;
public class MyToolbar extends JMenuBar {
Image myImage2 ;
public MyToolbar() {
ImageIcon("/home/pedro/JavaApplication1/FundoMenu2.bmp") ;
Image myImage2 =
Toolkit.getDefaultToolkit().getImage("/home/pedro/JavaApplication1/FundoMenu2.jpg")
;
}
public void paintComponent (Graphics g)
{
if(myImage2!= null)
{
g.drawImage(myImage2, 0, 0, this);
}
}
}
*********************************************
>>Hi all :
>>
[quoted text clipped - 22 lines]
> Not sure what you mean by JToolmenu. Do you mean JMenu or JMenuBar? If so,
> you can try the same technique with them.
Bill Tschumy - 17 Jun 2005 20:43 GMT
> do you mean like this ?
> It just puts a black stripe in 0,0 and the JMenuBar under it :-(
[quoted text clipped - 13 lines]
> ImageIcon("/home/pedro/JavaApplication1/FundoMenu2.bmp") ;
> Image myImage2 =
Toolkit.getDefaultToolkit().getImage("/home/pedro/JavaApplication1/FundoMenu2.
> jpg")
> ;
[quoted text clipped - 38 lines]
>> so,
>> you can try the same technique with them.
I suspect the problem is that the image isn't fully loaded. In Java, you
have to go through the extra step of waiting for the image to fully load
using the MediaTracker (a poor design decision IMO). Something like:
// The this argument is the component that will use the image
MediaTracker mt = new MediaTracker(this);
try
{
mt.addImage(image, 0);
mt.waitForID(0);
}
catch (InterruptedException e)
{
}
Now you can use the image for drawing.
Of course, it is also possible that you can't draw a background image for
JMenuBar. I have only done it for JPanels.

Signature
Bill Tschumy
Otherwise -- Austin, TX
http://www.otherwise.com