-
FEATURED COMPONENTS
First time here? Check out the FAQ!
I look up how to refresh the component from the control. it could be very interesting in the case of notifying users for status objects when they change in server side, eg : for an incoming message.
we take a simple example, I have an integer variable messagesCount that I update every second, how refresh the Label component messagesCountLabel that displays (messagesCount) in real time?
I use this method:
public void doAfterCompose(Component comp) throws Exception { // ... // ... new Thread(){ public void run(){ try { messagesCountLabel.setValue(getMessagesCount()); sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } } }.start();
but it returns the following exception:
java.lang.IllegalStateException: Components can be accessed only in event listeners
Use server push
thank you very much, it s excellent, I found a typical example in this link:
http://www.zkoss.org/smalltalks/stockchart/
Asked: 2010-02-17 11:04:52 +0800
Seen: 799 times
Last updated: Feb 17 '10