I would like to superpose a text on an image i loaded in order to simulate a
caption button.
Is it possible?
I have a class Buttons. it create insatances of myItem class
objMiddleM=new myItem(unitM,this,54+maxSize,12,"",href);
objMiddleM.setLocation(21,28+fac);
add(objMiddleM);
then myItem draw picture or string like this :
class myItem extends Canvas{
Image m_top;
menus owner;
int m_width,m_height;
String m_caption, m_href;
myItem(Image tp, menus mn,int w,int h,String caption,String href){
m_top=tp;
owner=mn;
m_width=w;
m_height=h;
m_caption=caption;
m_href=href;
this.setSize(m_width,m_height);
}
public void paint(Graphics g)
{
if (m_href!="")
{
Image t=createImage(m_width,m_height);
g.drawString("ok",0,0);
}else
g.drawImage(m_top,0,0,m_width,m_height,this);
}
public boolean mouseEnter(Event e,int i,int j)
{
owner.showStatus(m_href);
return true;
}
public boolean mouseExit(Event e,int i,int j)
{
owner.showStatus(m_caption);
return true;
}
}
but, i don't succeeded in.
I succeed in drawing picture from disk, but when i want to write a text on these
pictures i have a big problem.
Have you some advices?