Using JSwing components in jME

I have several jButtons, jFrames and jPanels in my program that are all interconnected and have several functionalities that I do not want to get rid of if I can help it. I wrote all of this code before I integrated my project into jME, and I tested today in jME and all of the JSwing components are working correctly. In the FAQ I read about you having to implement jME specific listeners and components, is this true? It appears to me that these Swing components DO work in jME so if I am allowed to use these components, how would I go about drawing 3D objects in jME to my jPanel? As of right now, I have two jFrames: the title page, where there are 3 buttons of which you click one to decide your class, and this moves you to the next jFrame, the game frame. The game frame has rectangles representing health bars which are very choppy and square looking along with several buttons with images and tooltips corresponding to your chosen class. My question is should I use Swing in its entirety for the few things I am looking for or rather implement a Nifty GUI that includes these components.

A summary of my two questions are the following:

  1. How should I alter my code for a jME program to function smoothly? Should I leave it in Swing, or if not, how can I implement JComponents in the Nifty GUI? The Nifty GUI tutorial talks about panels and screens and containers, but I am not sure which of these directly relate the the Java swing components or if they are completely separate Nifty components.
  2. How should I go about making a jRectangle less choppy? If it’s meant to be a 2D flat image of a health bar, how should I more smoothly assimilate the flat image into the 3D surrounding environment?

    Thank you for your time.



    Edit: Changed my question after reviewing the Nifty tutorial section.

You can embed a JME canvas into a swing application - although there are some limitations in the result.



The performance and suchlike of swing doesn’t really lend itself to games though and so its recommended to use something like nifty.



Nifty controls act as replacements for some (but not all) swing components. There are buttons, text fields, password fields, etc. Just look at the nifty controls and see if they meet your requirements.



jRectangle? What is that? I don’t recognise it as any standard swing component.



Displaying a health bar in Nifty is easy. Just display two nifty panels with the correct graphics and scale the top one accordingly from your code.

Alright, I have to turn in a working copy of the program in 5 days so I will stick to Swing for now and after when I have more time available I will transition to the Nifty GUI.