Try this code

// Make it a field
private final SimplePanel container = new SimplePanel();
...
// A function here
void setContent(Widget content)
{
        if(container.getWidget() != null)
             container.remove(container.getWidget());
        container.setWidget(content);
}

...
// In your code
MenuBar navMenu = new MenuBar(true);
MenuBar serviceMenu = new MenuBar();

Command cmdAbout = new Command() {
        public void execute() {
            setContent(new About());
        }
    };

Command cmdDesign = new Command() {
        public void execute() {
            setContent(new WebDesign());
        }
    };

navMenu.addItem("About Us", cmdAbout);
navMenu.addItem("Services", serviceMenu);
serviceMenu.addItem("design", cmdDesign);
...

Omer Akhter
BCSS05M012

On Jan 13, 3:06 am, Sahil Dave <[email protected]> wrote:
> On Mon, Jan 12, 2009 at 10:43 PM, A Friend Of Yours
> <[email protected]>wrote:
>
>
>
> > Sorry for late reply...
>
> > Can you put the exception and the code for changing contents here?
>
> *code:*
>
> final SimplePanel content = new SimplePanel();
> MenuBar navMenu = new MenuBar(true);
> MenuBar serviceMenu = new MenuBar();
>
> Command cmdAbout = new Command() {
>         public void execute() {
>             content.add(new About());
>         }
>     };
>
> Command cmdDesign = new Command() {
>         public void execute() {
>             content.add(new WebDesign());
>         }
>     };
>
> navMenu.addItem("About Us", cmdAbout);
> navMenu.addItem("Services", serviceMenu);
> serviceMenu.addItem("design", cmdDesign);
>
> --
> Sahil
--~--~---------~--~----~------------~-------~--~----~
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