|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.google.gwt.user.client.ui.UIObject
com.google.gwt.user.client.ui.Widget
com.google.gwt.user.client.ui.Image
public class Image
A widget that displays the image at a given URL.
public class ImageExample implements EntryPoint { private Label lbl = new Label(); public void onModuleLoad() { // Create an image, not yet referencing a URL. Image image = new Image(); // Hook up a load listener, so that we can find out when it loads (or // fails to, as the case may be). image.addLoadListener(new LoadListener() { public void onLoad(Widget sender) { lbl.setText("Done loading."); } public void onError(Widget sender) { lbl.setText("An error occurred while loading."); } }); // Point the image at a real URL. lbl.setText("Loading..."); image.setUrl("http://www.google.com/images/logo.gif"); // Add the image & label to the root panel. VerticalPanel panel = new VerticalPanel(); panel.add(lbl); panel.add(image); RootPanel.get().add(panel); } }
Constructor Summary | |
---|---|
Image()
Creates an empty image. |
|
Image(java.lang.String url)
Creates an image with a specified URL. |
Method Summary | |
---|---|
void |
addClickListener(ClickListener listener)
Adds a listener interface to receive click events. |
void |
addLoadListener(LoadListener listener)
Adds a listener interface to receive load events. |
void |
addMouseListener(MouseListener listener)
Adds a listener interface to receive mouse events. |
java.lang.String |
getUrl()
Gets the URL of the image. |
void |
onBrowserEvent(Event event)
Fired whenever a browser event is received. |
static void |
prefetch(java.lang.String url)
Causes the browser to pre-fetch the image at a given URL. |
void |
removeClickListener(ClickListener listener)
Removes a previously added listener interface. |
void |
removeLoadListener(LoadListener listener)
Removes a previously added listener interface. |
void |
removeMouseListener(MouseListener listener)
Removes a previously added listener interface. |
void |
setUrl(java.lang.String url)
Sets the URL of the image to be displayed. |
Methods inherited from class com.google.gwt.user.client.ui.Widget |
---|
getParent, isAttached, onAttach, onDetach, onLoad, removeFromParent |
Methods inherited from class com.google.gwt.user.client.ui.UIObject |
---|
addStyleName, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleName, getTitle, isVisible, isVisible, removeStyleName, setElement, setHeight, setPixelSize, setSize, setStyleName, setStyleName, setTitle, setVisible, setVisible, setWidth, sinkEvents, toString, unsinkEvents |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Image()
public Image(java.lang.String url)
url
- the URL of the image to be displayedMethod Detail |
---|
public static void prefetch(java.lang.String url)
url
- the URL of the image to be prefetchedpublic void addClickListener(ClickListener listener)
SourcesClickEvents
addClickListener
in interface SourcesClickEvents
listener
- the listener interface to addpublic void addLoadListener(LoadListener listener)
SourcesLoadEvents
addLoadListener
in interface SourcesLoadEvents
listener
- the listener interface to addpublic void addMouseListener(MouseListener listener)
SourcesMouseEvents
addMouseListener
in interface SourcesMouseEvents
listener
- the listener interface to addpublic java.lang.String getUrl()
public void onBrowserEvent(Event event)
EventListener
onBrowserEvent
in interface EventListener
onBrowserEvent
in class Widget
event
- the event receivedpublic void removeClickListener(ClickListener listener)
SourcesClickEvents
removeClickListener
in interface SourcesClickEvents
listener
- the listener interface to removepublic void removeLoadListener(LoadListener listener)
SourcesLoadEvents
removeLoadListener
in interface SourcesLoadEvents
listener
- the listener interface to removepublic void removeMouseListener(MouseListener listener)
SourcesMouseEvents
removeMouseListener
in interface SourcesMouseEvents
listener
- the listener interface to removepublic void setUrl(java.lang.String url)
url
- the image URL
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |