Question

I extended a Widget, but how can i pass constructor vars to it :

    public class MenuBarNav extends MenuBar{

      public MenuBarNav() {
            this(true);

      }

    public MenuBarNav(boolean b) {


    }   

}

and then ;

MenuBarNav ksw = new MenuBarNav(true);

Normaly it is :

MenuBar test = new MenuBar(true);

and it shows me the Menu vertical.

do i have to extend it as Composite `?

Was it helpful?

Solution

As a rule of thumb, you shouldn't extend widgets and should instead compose widgets (within a Composite).

In your specific case of why it doesn't work and how to make it work, Java 101:

public MenuBarNav(boolean b) {
  super(b);
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top