
public class Image extends Widget implements SourcesLoadEvents, HasLoadHandlers, HasErrorHandlers, SourcesClickEvents, HasClickHandlers, HasDoubleClickHandlers, HasAllDragAndDropHandlers, HasAllGestureHandlers, HasAllMouseHandlers, HasAllTouchHandlers, SourcesMouseEvents
If an image transitions between clipped mode and unclipped mode, any
Element-specific attributes added by the user (including style
attributes, style names, and style modifiers), except for event listeners,
will be lost.
UIObject.DebugIdImpl, UIObject.DebugIdImplEnabledDEBUG_ID_PREFIX| Modifier | Constructor and Description |
|---|---|
|
Image()
Creates an empty image.
|
protected |
Image(Element element)
This constructor may be used by subclasses to explicitly use an existing
element.
|
|
Image(ImageResource resource)
Creates an image whose size and content are defined by an ImageResource.
|
|
Image(SafeUri url)
Creates an image with a specified URL.
|
|
Image(SafeUri url,
int left,
int top,
int width,
int height)
Creates a clipped image with a specified URL and visibility rectangle.
|
|
Image(String url)
Creates an image with a specified URL.
|
|
Image(String url,
int left,
int top,
int width,
int height)
Creates a clipped image with a specified URL and visibility rectangle.
|
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, doAttachChildren, doDetachChildren, fireEvent, getHandlerCount, getLayoutData, getParent, isAttached, isOrWasAttached, onAttach, onDetach, onUnload, removeFromParent, setLayoutData, sinkEvents, unsinkEventsaddStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, resolvePotentialElement, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkBitlessEvent, toStringfireEventpublic Image()
public Image(ImageResource resource)
resource - the ImageResource to be displayedpublic Image(String url)
url - the URL of the image to be displayedpublic Image(SafeUri url)
url - the URL of the image to be displayedpublic Image(String url, int left, int top, int width, int height)
url - the URL of the image to be displayedleft - the horizontal co-ordinate of the upper-left vertex of the
visibility rectangletop - the vertical co-ordinate of the upper-left vertex of the
visibility rectanglewidth - the width of the visibility rectangleheight - the height of the visibility rectanglepublic Image(SafeUri url, int left, int top, int width, int height)
url - the URL of the image to be displayedleft - the horizontal co-ordinate of the upper-left vertex of the
visibility rectangletop - the vertical co-ordinate of the upper-left vertex of the
visibility rectanglewidth - the width of the visibility rectangleheight - the height of the visibility rectangleprotected Image(Element element)
element - the element to be usedpublic static void prefetch(String url)
url - the URL of the image to be prefetchedpublic static void prefetch(SafeUri url)
url - the URL of the image to be prefetchedpublic static Image wrap(Element element)
RootPanel.detachNow(Widget).element - the element to be wrappedpublic HandlerRegistration addClickHandler(ClickHandler handler)
HasClickHandlersClickEvent handler.addClickHandler in interface HasClickHandlershandler - the click handlerHandlerRegistration used to remove this handler@Deprecated public void addClickListener(ClickListener listener)
addClickHandler(com.google.gwt.event.dom.client.ClickHandler) insteadSourcesClickEventsaddClickListener in interface SourcesClickEventslistener - the listener interface to addpublic HandlerRegistration addDoubleClickHandler(DoubleClickHandler handler)
HasDoubleClickHandlersDoubleClickEvent handler.addDoubleClickHandler in interface HasDoubleClickHandlershandler - the double click handlerHandlerRegistration used to remove this handlerpublic HandlerRegistration addDragEndHandler(DragEndHandler handler)
HasDragEndHandlersDragEndEvent handler.addDragEndHandler in interface HasDragEndHandlershandler - the drag end handlerHandlerRegistration used to remove this handlerpublic HandlerRegistration addDragEnterHandler(DragEnterHandler handler)
HasDragEnterHandlersDragEnterEvent handler.addDragEnterHandler in interface HasDragEnterHandlershandler - the drag end handlerHandlerRegistration used to remove this handlerpublic HandlerRegistration addDragHandler(DragHandler handler)
HasDragHandlersDragEvent handler.addDragHandler in interface HasDragHandlershandler - the drag handlerHandlerRegistration used to remove this handlerpublic HandlerRegistration addDragLeaveHandler(DragLeaveHandler handler)
HasDragLeaveHandlersDragLeaveEvent handler.addDragLeaveHandler in interface HasDragLeaveHandlershandler - the drag leave handlerHandlerRegistration used to remove this handlerpublic HandlerRegistration addDragOverHandler(DragOverHandler handler)
HasDragOverHandlersDragOverEvent handler.addDragOverHandler in interface HasDragOverHandlershandler - the drag over handlerHandlerRegistration used to remove this handlerpublic HandlerRegistration addDragStartHandler(DragStartHandler handler)
HasDragStartHandlersDragStartEvent handler.addDragStartHandler in interface HasDragStartHandlershandler - the drag start handlerHandlerRegistration used to remove this handlerpublic HandlerRegistration addDropHandler(DropHandler handler)
HasDropHandlersDropEvent handler.addDropHandler in interface HasDropHandlershandler - the drop handlerHandlerRegistration used to remove this handlerpublic HandlerRegistration addErrorHandler(ErrorHandler handler)
HasErrorHandlersErrorEvent handler.addErrorHandler in interface HasErrorHandlershandler - the error handlerHandlerRegistration used to remove this handlerpublic HandlerRegistration addGestureChangeHandler(GestureChangeHandler handler)
HasGestureChangeHandlersGestureChangeEvent handler.addGestureChangeHandler in interface HasGestureChangeHandlershandler - the gesture change handlerHandlerRegistration used to remove this handlerpublic HandlerRegistration addGestureEndHandler(GestureEndHandler handler)
HasGestureEndHandlersGestureEndEvent handler.addGestureEndHandler in interface HasGestureEndHandlershandler - the gesture end handlerHandlerRegistration used to remove this handlerpublic HandlerRegistration addGestureStartHandler(GestureStartHandler handler)
HasGestureStartHandlersGestureStartEvent handler.addGestureStartHandler in interface HasGestureStartHandlershandler - the gesture start handlerHandlerRegistration used to remove this handlerpublic HandlerRegistration addLoadHandler(LoadHandler handler)
HasLoadHandlersLoadEvent handler.addLoadHandler in interface HasLoadHandlershandler - the load handlerHandlerRegistration used to remove this handler@Deprecated public void addLoadListener(LoadListener listener)
LoadHandler and
ErrorHandler insteadSourcesLoadEventsaddLoadListener in interface SourcesLoadEventslistener - the listener interface to addpublic HandlerRegistration addMouseDownHandler(MouseDownHandler handler)
HasMouseDownHandlersMouseDownEvent handler.addMouseDownHandler in interface HasMouseDownHandlershandler - the mouse down handlerHandlerRegistration used to remove this handler@Deprecated public void addMouseListener(MouseListener listener)
addMouseOverHandler(com.google.gwt.event.dom.client.MouseOverHandler) addMouseMoveHandler(com.google.gwt.event.dom.client.MouseMoveHandler),
addMouseDownHandler(com.google.gwt.event.dom.client.MouseDownHandler), addMouseUpHandler(com.google.gwt.event.dom.client.MouseUpHandler) and
addMouseOutHandler(com.google.gwt.event.dom.client.MouseOutHandler) insteadSourcesMouseEventsaddMouseListener in interface SourcesMouseEventslistener - the listener interface to addpublic HandlerRegistration addMouseMoveHandler(MouseMoveHandler handler)
HasMouseMoveHandlersMouseMoveEvent handler.addMouseMoveHandler in interface HasMouseMoveHandlershandler - the mouse move handlerHandlerRegistration used to remove this handlerpublic HandlerRegistration addMouseOutHandler(MouseOutHandler handler)
HasMouseOutHandlersMouseOutEvent handler.addMouseOutHandler in interface HasMouseOutHandlershandler - the mouse out handlerHandlerRegistration used to remove this handlerpublic HandlerRegistration addMouseOverHandler(MouseOverHandler handler)
HasMouseOverHandlersMouseOverEvent handler.addMouseOverHandler in interface HasMouseOverHandlershandler - the mouse over handlerHandlerRegistration used to remove this handlerpublic HandlerRegistration addMouseUpHandler(MouseUpHandler handler)
HasMouseUpHandlersMouseUpEvent handler.addMouseUpHandler in interface HasMouseUpHandlershandler - the mouse up handlerHandlerRegistration used to remove this handlerpublic HandlerRegistration addMouseWheelHandler(MouseWheelHandler handler)
HasMouseWheelHandlersMouseWheelEvent handler.addMouseWheelHandler in interface HasMouseWheelHandlershandler - the mouse wheel handlerHandlerRegistration used to remove this handler@Deprecated public void addMouseWheelListener(MouseWheelListener listener)
addMouseWheelHandler(com.google.gwt.event.dom.client.MouseWheelHandler) insteadpublic HandlerRegistration addTouchCancelHandler(TouchCancelHandler handler)
HasTouchCancelHandlersTouchCancelEvent handler.addTouchCancelHandler in interface HasTouchCancelHandlershandler - the touch cancel handlerHandlerRegistration used to remove this handlerpublic HandlerRegistration addTouchEndHandler(TouchEndHandler handler)
HasTouchEndHandlersTouchEndEvent handler.addTouchEndHandler in interface HasTouchEndHandlershandler - the touch end handlerHandlerRegistration used to remove this handlerpublic HandlerRegistration addTouchMoveHandler(TouchMoveHandler handler)
HasTouchMoveHandlersTouchMoveEvent handler.addTouchMoveHandler in interface HasTouchMoveHandlershandler - the touch move handlerHandlerRegistration used to remove this handlerpublic HandlerRegistration addTouchStartHandler(TouchStartHandler handler)
HasTouchStartHandlersTouchStartEvent handler.addTouchStartHandler in interface HasTouchStartHandlershandler - the touch start handlerHandlerRegistration used to remove this handlerpublic String getAltText()
public int getHeight()
public int getOriginLeft()
public int getOriginTop()
public String getUrl()
public int getWidth()
public void onBrowserEvent(Event event)
EventListeneronBrowserEvent in interface EventListeneronBrowserEvent in class Widgetevent - the event received@Deprecated public void removeClickListener(ClickListener listener)
HandlerRegistration.removeHandler() method on the
object returned by addClickHandler(com.google.gwt.event.dom.client.ClickHandler) insteadSourcesClickEventsremoveClickListener in interface SourcesClickEventslistener - the listener interface to remove@Deprecated public void removeLoadListener(LoadListener listener)
HandlerRegistration.removeHandler() method on the
object returned by an add*Handler method insteadSourcesLoadEventsremoveLoadListener in interface SourcesLoadEventslistener - the listener interface to remove@Deprecated public void removeMouseListener(MouseListener listener)
HandlerRegistration.removeHandler() method on the
object returned by an add*Handler method insteadSourcesMouseEventsremoveMouseListener in interface SourcesMouseEventslistener - the listener interface to remove@Deprecated public void removeMouseWheelListener(MouseWheelListener listener)
HandlerRegistration.removeHandler() method on the
object returned by addMouseWheelHandler(com.google.gwt.event.dom.client.MouseWheelHandler) insteadpublic void setAltText(String altText)
altText - the alternate text to set topublic void setResource(ImageResource resource)
resource - the ImageResource to displaypublic void setUrl(SafeUri url)
url - the image URLpublic void setUrl(String url)
url - the image URLpublic void setUrlAndVisibleRect(SafeUri url, int left, int top, int width, int height)
url - the image URLleft - the horizontal coordinate of the upper-left vertex of the
visibility rectangletop - the vertical coordinate of the upper-left vertex of the
visibility rectanglewidth - the width of the visibility rectangleheight - the height of the visibility rectanglepublic void setUrlAndVisibleRect(String url, int left, int top, int width, int height)
url - the image URLleft - the horizontal coordinate of the upper-left vertex of the
visibility rectangletop - the vertical coordinate of the upper-left vertex of the
visibility rectanglewidth - the width of the visibility rectangleheight - the height of the visibility rectanglepublic void setVisibleRect(int left,
int top,
int width,
int height)
left - the horizontal coordinate of the upper-left vertex of the
visibility rectangletop - the vertical coordinate of the upper-left vertex of the
visibility rectanglewidth - the width of the visibility rectangleheight - the height of the visibility rectangleCopyright © 2016. All rights reserved.