Hi all,
I was wondering how we could place an image (e.g. png) on a button. Of course, using a theme works but unfortunately this does not help as we do not have the images available upfront and therefore can not "hard-code" them in a theme.
So far I was trying to use the following code:
[code]
Button btn = new Button() {
@Override
protected void afterAddToGUI(final GUI gui) {
Texture texture = gui.getRenderer().loadTexture(pngFileLocation, "RGBA", "linear");
setBackground(texture.getImage(0,0, texture.getWidth(), texture.getHeight, null, false, Rotation.NONE);
}
}
[/code]
Background:
We are using TWL within an Eclipse rich client application. Other plugins may contribute extensions to our GUI that contain buttons with images. As we do not know what will be contributed before, we need to set the image of a button within the code when evaluating the UI contributions. The Button shall look like a regular button (designed by a theme

but instead of text, an image shall be shown.
Any help would be great.
Thanks,
Holger