Hey Guys,
I want to setup a nifty controller in java, but I cannot figure out how to correctly bind the gui to a panel. If I use this code:
[java]
final PanelBuilder pb = new PanelBuilder() { {
this.childLayoutCenter();
this.control( new ControlBuilder( “#TestBar”, “barBlue” ){
{
this.width( “400px”);
this.height( “20px”);
this.controller( new MyController(“Essential input argument”) );
}
});
this.x( x + “px” );
this.y( y + “px” );
this.width( “800px” );
this.height( “100px” );
}
};
[/java]
Then nifty instantiates a new instance of “MyController” and binds that to the panel. Alternatively I do this:
[java]
final PanelBuilder pb = new PanelBuilder() { {
this.childLayoutCenter();
this.controller( new MyController(“Essential input argument”) );
this.control( new ControlBuilder( “#TestBar”, “barBlue” ){
{
this.width( “400px”);
this.height( “20px”);
}
});
this.x( x + “px” );
this.y( y + “px” );
this.width( “800px” );
this.height( “100px” );
}
};
[/java]
And nifty does the same… Using this.[java]this.control( new ControlBuilder( “#TestBar”, “barBlue” )[/java] seems to be the only way to make use of my XML setup of the control, but [java]this.controller( new MyController(“Essential input argument”) );[/java] is the easiest way for me to configure a few input arguments.
Does anyone know a solution?