Wow. With this GUI, it’s very quick and easy to create new stuff. I didn’t see anything about tabbed menus (a la Nifty: http://sourceforge.net/apps/mediawiki/nifty-gui/index.php?title=Standard_Controls_Tabs), so I constructed an example tabbed menu system using just a few buttons and panels:
[java]
Screen screen = new Screen(app);
float height = screen.getHeight();
float width = screen.getWidth();
float pad = 15.0f;
//Step 1: Create overlapping, non-movable panels for each tab
Panel graphicsPanel = new Panel(screen, "gPanel", new Vector2f(pad, height/2), new Vector2f(width-2*pad, height/2-pad));
graphicsPanel.setIsMovable(false);
graphicsPanel.setIsResizable(false);
graphicsPanel.setText("This is the Graphics Panel!");
graphicsPanel.setTextPadding(10.0f);
Panel audioPanel = new Panel(screen, "aPanel", new Vector2f(pad, height/2), new Vector2f(width-2*pad, height/2-pad));
audioPanel.setIsMovable(false);
audioPanel.setIsResizable(false);
audioPanel.setText("This is the Audio Panel!");
audioPanel.setTextPadding(10.0f);
Panel inputPanel = new Panel(screen, "iPanel", new Vector2f(pad, height/2), new Vector2f(width-2*pad, height/2-pad));
inputPanel.setIsMovable(false);
inputPanel.setIsResizable(false);
inputPanel.setText("This is the Input Panel!");
inputPanel.setTextPadding(10.0f);
Panel miscPanel = new Panel(screen, "mPanel", new Vector2f(pad, height/2), new Vector2f(width-2*pad, height/2-pad));
miscPanel.setIsMovable(false);
miscPanel.setIsResizable(false);
miscPanel.setText("This is the Miscellaneous Panel!");
miscPanel.setTextPadding(10.0f);
//Step 2: Create separate panel above the tab panels, to host the navigation buttons
Panel buttonPanel = new Panel(screen, "buttonPanel", new Vector2f(pad, height/2-2*pad), new Vector2f(width-2*pad, 2*pad));
buttonPanel.setIsMovable(false);
buttonPanel.setIsResizable(false);
buttonPanel.setGlobalAlpha(0); //make the panel itself invisible, only showing buttons
//Step 3: Create buttons. Left click hides/shows appropriate panels.
ButtonAdapter graphicsButton = new ButtonAdapter(screen, "gButton", new Vector2f(0, 0)) {
@Override
public void onButtonMouseLeftDown(MouseButtonEvent event, boolean toggled) {
screen.getElementById("aPanel").hide();
screen.getElementById("iPanel").hide();
screen.getElementById("mPanel").hide();
screen.getElementById("gPanel").show();
}
};
graphicsButton.setText("Graphics");
ButtonAdapter audioButton = new ButtonAdapter(screen, "aButton", new Vector2f(100, 0)) {
@Override
public void onButtonMouseLeftDown(MouseButtonEvent event, boolean toggled) {
screen.getElementById("aPanel").show();
screen.getElementById("iPanel").hide();
screen.getElementById("mPanel").hide();
screen.getElementById("gPanel").hide();
}
};
audioButton.setText("Audio");
ButtonAdapter inputButton = new ButtonAdapter(screen, "iButton", new Vector2f(200, 0)) {
@Override
public void onButtonMouseLeftDown(MouseButtonEvent event, boolean toggled) {
screen.getElementById("aPanel").hide();
screen.getElementById("iPanel").show();
screen.getElementById("mPanel").hide();
screen.getElementById("gPanel").hide();
}
};
inputButton.setText("Input");
ButtonAdapter miscButton = new ButtonAdapter(screen, "mButton", new Vector2f(300, 0)) {
@Override
public void onButtonMouseLeftDown(MouseButtonEvent event, boolean toggled) {
screen.getElementById("aPanel").hide();
screen.getElementById("iPanel").hide();
screen.getElementById("mPanel").show();
screen.getElementById("gPanel").hide();
}
};
miscButton.setText("Misc");
//Step 4: Add buttons to the button panel, set initial panel hide/show stats, then add all panels to the screen
buttonPanel.addChild(graphicsButton);
buttonPanel.addChild(audioButton);
buttonPanel.addChild(inputButton);
buttonPanel.addChild(miscButton);
audioPanel.hide();
inputPanel.hide();
miscPanel.hide();
graphicsPanel.show();
screen.addElement(buttonPanel);
screen.addElement(graphicsPanel);
screen.addElement(audioPanel);
screen.addElement(inputPanel);
screen.addElement(miscPanel);
screen.initialize();
guiNode.addControl(screen);
[/java]
Edit: Quick view of it in action. Note this is not very fancy at this point!
[video]http://www.youtube.com/watch?v=0onCXmdqnsM&feature=youtu.be[/video]