Not A Problem - Just Add The Timer Behaviour To Your Custom Subclass
Of Label. For Example, You Could Add A SetVisible Method To This Label
Subclass That Also Includes a Milliseconds Parameter (The Time To
Display The Message). All Your Method Does Is Call Super.SetVisible
(X), And Then Start The Timer. The Timer Code You Pasted Looks Fine,
So You Can Just Use That. If You Are Concerned That Thirty Timers Are
Too Much To Handle, I Wouldn't Worry Too Much. However, If Practical
Testing Really Reveals That Is A Problem, You Can Do This. I'd Still
Go The Route Of A Custom Class, though. Basically, Create A Mapping Of
Event Times (The Time In Milliseconds When The Message Should
Disappear) And Store This In A TreeMap. Then, Set Up A Single Timer
That Waits Until The First Time In The Mapping Is 'Up'. The Code Sort
Of Writes Itself From There. If A New Timer Is Added, You Should Check
If It's Up Sooner Than The First Thing In The Map, And If So, Cancel
And Restart The Timer With The New Shorter Time.

NB: It Is More Common In The English Language To Capitalize The Word
"I" And The First Letter In Every Sentence. Your Style Of Capitalizing
At Random Is Not So Much Of A Standard. I Admit, It Looks Hilarious
Though. Ta!

On Nov 29, 7:48 am, jagadesh <[EMAIL PROTECTED]> wrote:
> Hi Guys,
>
> I am Working On A Screen Where i Need to Display some Error Message
> and Some Success Messages.What i did is i created my own widget of
> some Label type . when ever i need to show a message i would set the
> text to label and display it on the top of the screen much like gmail.
>
> the issue i added a timer for the label so that it disappears
> automatically after some time.
>
> i have written the code like this,
>
> Timer t = new Timer() {
>                                 public void run() {
>                                         header.setErrorMessage("Error 
> Message");
>                                         header.setVisible(true);
>                                         setWidget(0, 1, header);
>                                 }
>                         };
>                         t.schedule(500);
>
> header is my label type of element. i was displaying some 30 types of
> different message. so my timer code has increased a lot . can any one
> suggest me how to use a single timer class for all.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to