Reputation: 374
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 `?
Upvotes: 0
Views: 30
Reputation: 64541
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);
}
Upvotes: 2