how to display an image during loading

19 views
Skip to first unread message

anna23

unread,
Jul 9, 2008, 4:32:49 AM7/9/08
to Google Web Toolkit

Hi
in my progressBar I want to display a picture (animated gif)
now I create my image and I spend URL, but how do I show my image
during loading and hidden when the loading is finished
thank you

public void showProgressBar()
{
if (_progressBar == null)
{
_progressBar = new ProgressBar(20, ProgressBar.SHOW_TEXT);
_progressBar.setText("Loading ...");
//_progressBar.setBorderWidth(1);
_progressBar.setSize("100", "20");
_progressBar.setVisible(true);
absolutePanel.add(_progressBar, 600, 725);

Image monImage = new Image();
monImage.setUrl("loadinfo.net(2).gif");
RootPanel.get().add(monImage,10,130);

}
_progressBar.setVisible(true);
}

/**
* hidethe progressBar
*/
public void hideProgressBar()
{

if (_progressBar != null)
_progressBar.setVisible(false);

}

Reinier Zwitserloot

unread,
Jul 9, 2008, 6:24:53 AM7/9/08
to Google Web Toolkit
Don't add the progress bar to your GWT code; your GWT code won't run
until the loading is already done!

Add it straight to the HTML page that has the <script
src="...blahblahblah-nocache-gwt.js"> tag, wrap it into a div with an
ID, and then the first thing you do in your GWT code is:

Element loader = DOM.getElementByID("loaderImg");
DOM.setStyleAttribute(loader, "display", "none");

or remove it from the body with DOM.removeFromChild.
Reply all
Reply to author
Forward
0 new messages