Hello,
I tried creating a window with nifty but it did not work. For testing I tried using a TextField and this control does not work either. I’ll post some code. Is that my mistake? I’m using the nightly build from 07.02.2012.
Adding panels, texts and layers works fine.
[java]public class MeshEditor extends SimpleApplication {
private Nifty nifty;
private String defaultFont = “assets/fonts/Default.fnt”;
public MeshEditor() {
super();
}
@Override
public void simpleInitApp() {
flyCam.setDragToRotate(true);
NiftyJmeDisplay niftyDisplay = new NiftyJmeDisplay(assetManager, inputManager, audioRenderer, guiViewPort);
nifty = niftyDisplay.getNifty();
initGUI();
guiViewPort.addProcessor(niftyDisplay);
} //End simpleInitApp()
private void initGUI() {
new ScreenBuilder(“start”) {
{
layer(new LayerBuilder(“layer”) {
{
childLayoutCenter();
backgroundColor("#003f");
control(new TextFieldBuilder(“input”, “hello textfield”) {
{
width(“200px”);
font(defaultFont);
}
});
}
});
}
}.build(nifty);
nifty.gotoScreen(“start”);
}//End initGUI();
public static void main(String[] moep) {
new MeshEditor().start();
}
} //End MeshEditor[/java]
Fixed that. I have deleted the style importing lines by accident :roll: Sorry for useless post.
1 Like