You could use a flex table instead of the horizontal panel and add the
separator as text:
FlexTable table = new FlexTable();
table.setWidget(0, 0, about);
table.setText(0, 1, "|");
table.setWidget(0, 2, register);
table.setText(0, 3, "|");
table.setWidget(0, 4 login);

But you're right, a widget cannot appear in several places at the same
time (look at the code for the add method all panels, they all call
removeFromParent before adding the widget to the panel)

On May 1, 12:12 pm, hezjing <[email protected]> wrote:
> Hi
>
> I want to create a menu contains hyperlinks, and looks like "About us |
> Register | Login".
>
> Here is my code:
>
>         Hyperlink about = new Hyperlink("About us", "about");
>         Hyperlink register = new Hyperlink("Register", "register");
>         Hyperlink login = new Hyperlink("Login", "login");
>
>         // create a label to show the separator "|"
>         Label separator = new Label("|");
>         separator.addStyleName("menu");
>
>         HorizontalPanel menu = new HorizontalPanel();
>         menu.add(about);
>
>         // add the label "|" the 1st time
>         menu.add(separator);
>         menu.add(register);
>
>         // add the label "|" the 2nd time
>         menu.add(separator);
>         menu.add(login);
>
> The first label (or the separator) does not show up :-(
> It seems that we cannot add a same label more than once.
>
> The label does nothing but merely to show the separators, do we have other
> choice except to create a new label for every separator?
>
> --
>
> Hez
--~--~---------~--~----~------------~-------~--~----~
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