Ive tried all tutorials etc but cant make it work…
Can anyone write a commented code explaining how to use the basic of any GUI libraries for JME???
Like how to add to this program a menu for exit the program:
import com.jme.app.SimpleGame;
import com.jme.bounding.BoundingSphere;
import com.jme.renderer.Renderer;
import com.jme.scene.Node;
import com.jme.scene.shape.Sphere;
/**
* Started Date: Jul 20, 2004<br><br>
* Simple Main program for jME
@author Jack Lindamood
*/
public class Main extends SimpleGame
{
private Node guiNode;
public static void main(String[] args)
{
Main app=new Main(); // Create Object
app.setConfigShowMode(ConfigShowMode.ShowIfNoConfig);
// Signal to show properties dialog
app.start(); // Start the program
}
protected void simpleInitGame()
{
Sphere s = new Sphere("my first sphere", 30, 30, 25);
s.setModelBound(new BoundingSphere());
s.updateModelBound();
rootNode.attachChild(s);
}
}
or why isnt this code working:
import com.jme.app.SimpleGame;
import com.jme.bounding.BoundingSphere;
import com.jme.renderer.Renderer;
import com.jme.scene.Node;
import com.jme.scene.shape.Sphere;
import com.jmex.awt.swingui.JMEDesktop;
import javax.swing.JButton;
/**
* Started Date: Jul 20, 2004<br><br>
* Simple Main program for jME
*
* @author Jack Lindamood
*/
public class Main extends SimpleGame
{
private Node guiNode;
public static void main(String[] args)
{
Main app=new Main(); // Create Object
app.setConfigShowMode(ConfigShowMode.ShowIfNoConfig);
// Signal to show properties dialog
app.start(); // Start the program
}
protected void simpleInitGame()
{
Sphere s = new Sphere("my first sphere", 30, 30, 25);
s.setModelBound(new BoundingSphere());
s.updateModelBound();
rootNode.attachChild(s);
guiNode = new Node( "gui" );
guiNode.setRenderQueueMode( Renderer.QUEUE_ORTHO );
// create the desktop Quad
final JMEDesktop desktop = new JMEDesktop( "desktop", 500, 400, input );
// and attach it to the gui node
guiNode.attachChild( desktop );
JButton but = new JButton("lol");
desktop.getJDesktop().add(but);
rootNode.attachChild(guiNode);
}
}