Wednesday, December 26, 2012

Re:

Yes, in my previous code I just had to add t.scheduleRepeating(1000); instead t.schedule(1000);


On Wed, Dec 26, 2012 at 7:48 PM, Arian Gerryts <arianul@gmail.com> wrote:
I did a simlar thing once where I used swing components

something like

label = new JLabel();                       pane.add(label);          add(pane);          sdf = new SimpleDateFormat("HH:mm:ss");          date = new Date();            s = sdf.format(date);          label.setText(s);          setVisible(true);          runner = new Thread(this);            while(runner == null)          {              runner = new Thread(this);              runner.start();            }

and then

public void run() { while(true) { try { Thread.sleep(1000); sdf = new SimpleDateFormat("HH:mm:ss"); date = new Date(); s = sdf.format(date); label.setText(s); } catch(Exception e){} }



On Wed, Dec 26, 2012 at 12:36 PM, Aldin Habibović <habibovic.aldin@gmail.com> wrote:
Hi guys,

How to achieve digital time in GWT.  I try this code:


final TextBox textBox = new TextBox();

     Timer t = new Timer() {
           
            @Override
            public void run() {                 
                  textBox.setText(new Date()+"");
            }
        };
        t.schedule(1000);

but didn't work. Please help.

--
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 google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

--
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 google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

--
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 google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment