PDA

View Full Version : how to add an icon to the button



Mike_javaJunior
14 Feb 2013, 4:19 AM
the problem is that when I'm trying to set the icon for the button with
button.setIcon()
it asks for something that I cant understand what is it.
it asks for AbstractImagePrototype
I'm trying to create an instanse, it opens a constructor in which I don't cnow what to do.

AbstractImagePrototype aip = new AbstractImagePrototype() { @Override
public void applyTo(Image image) {
//To change body of implemented methods use File | Settings | File Templates.
}


@Override
public Image createImage() {
return null; //To change body of implemented methods use File | Settings | File Templates.
}


@Override
public String getHTML() {
return null; //To change body of implemented methods use File | Settings | File Templates.
}
}
so help me please. How can I set the icon to the button?

Mike_javaJunior
18 Feb 2013, 3:49 AM
Oh! thank you all. I've found the solution myself.
my problem was that this way is wrong. to add an icon to the button I need to use button.setIconStyle() and that's it. everything is simple and works. the only problem is that the icon must have the concrete size, otherwise it won't be seen or will be too small.