Render an image
What is the best way to render an image in GXT?
I need it to be involved in layout system and to be active component.
Can you be more specific? What kind of image, and how do you want it to take part in layout - or just to be resized? Is it enough to extend BoxComponent, and to draw an <img> tag with that, and override onResize to grow/shrink it?
What do you mean by 'active component'? If it extends Component (or some subclass), you will be able to add listeners to events, based on what events you sink to the dom.
I want it basically to behave like a button. I want to be able to set an action listener to it on click. I want cursor to change to pointer when your mouse is hanging over an image. I want the parent to change it's size according to the image size.
Originally Posted by Colin Alworth
Just as a usual component, that's all I need.
Try subclassing BoxComponent, and going from there, starting with building onRender to draw as you want it to. It looks like setSize (invoked by layout) should be already set to resize the basic element drawn.
To get events call sinkEvents - take a look at how Button sets that up in its onRender method. Looking at Field and some of its subclasses should give you more ideas.