Why you add again the button in refreshStopList()?

// Button is added to the Screen.
         hPanel.add(Stop1Button);

2011/3/25 Rodrigo JS <[email protected]>

> Hi All,
>
> I am new to GWT and was trying to create an horizontal panel with 5
> Buttons on it. So far, so good.
>
> Point is that when I implemented the method that would define what to
> be written in each Button it did not work.
>
> Can anyone helpe me?
>
> Thanks,
> Rodrigo
>
>  public void onModuleLoad() {
>
>          hPanel.setSpacing(10);
>
>          // Add some content to the panel
>          hPanel.add(Stop1Button);
>          Stop1Button.addStyleName("B1");
>          hPanel.add(Stop2Button);
>          Stop2Button.addStyleName("B2");
>          hPanel.add(Stop3Button);
>          Stop3Button.addStyleName("B3");
>          hPanel.add(Stop4Button);
>          Stop4Button.addStyleName("B2");
>          hPanel.add(Stop5Button);
>          Stop5Button.addStyleName("B1");
>
>          // Associate the Main panel - hPanel - with the HTML host page.
>          RootPanel.get("stopList").add(hPanel);
>
>          // Setup timer to refresh list periodically.
>          Timer refreshTimer = new Timer() {
>            @Override
>            public void run() {
>              refreshStopList();
>            }
>          };
>          refreshTimer.scheduleRepeating(REFRESH_INTERVAL);
>  }
>
>  private void refreshStopList() {
>
>          // For testing purpose, generate a second screen with different
> text then the first one
>
>          // hPanel is cleared
>          hPanel.clear();
>
>          // I could do it altogether , but am testing if it is working step
> by step
>          // Text generated in tester is associated with a variable
>          textButton1 = "Test 1";
>          // Text received is attributed to a button
>          Stop1Button.setText(textButton1);
>
>          // Button is added to the Screen.
>          hPanel.add(Stop1Button);
>
>          // hPanel is associated with the screen
>          RootPanel.get("stopList").add(hPanel);
>
>  }
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Web Toolkit" group.
> To post to this group, send email to [email protected].
> 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.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
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