In my game I am trying to use Swing GUI as I am more used to it than nifty. I used the code from the wiki page regarding using Swing GUI. My question is no matter what I try, I always get an error when I try to add an action listener to a JButton. Please help
It appears you are very new to Java, many people will say learning to make a game is a terrible way to also learn Java, many people are probably right.
That said if you hit a roadblock you need to find a way to overcome it, so I’ll point you to the terms you’ll want to read up on.
I don’t want to dissuade you from learning, but I would advise you to try making a stand alone, not jme related thing using swing before you try to use swing with jme. Making a simple Swing application that you can try creating and modifying your own classes in will be a better way to grasp Object Oriented coding than trying to work with Swing running on top of a Jme canvas.
Swing with Jme has a lot of overhead, threading issues and other annoying issues (swing tends to draw windows behind the jme canvas by default for example).
Use Lemur gui GitHub - jMonkeyEngine-Contributions/Lemur: Lemur is a jMonkeyEngine-based UI toolkit.. Lemur was designed to work inside JME in a very simple way, and the tutorials are pretty good for getting started. Lemur was designed to mimic Swing in alot of ways so it should be very familiar, except instead of attaching things to frames you’ll attach ui elements to a node in the jme scenegraph (usually the guiNode if you’re using SimpleApplication)