Can't get UIManager.setLookAndFeel() to work with JMEDesktopPane

I've gotten JMEDesktopPane to work, in that it's showing up where I want it and displaying the window/s I want.

However, I can't make it display any L&F other than the plain Windows L&F. I'm using JRE 6 update 3 (or whatever the latest is – got it two days ago) with the 1.0 release of jME (jars, not source), and building using Eclipse 6.0 (which shouldn't matter).

Here's my code from the main class:

   public static void main(String[] args) {
      try {


         GameSettings gs = new PreferencesGameSettings(Preferences.userRoot());

Later, I create the desktop (actually, multiple desktops, only one of which is visible at a time) and a JInternalFrame on it. That JInternalFrame shows up with Windows decoration, not Motif. I've also tried requesting the Metal L&F with no success.

Figured I'd post the actual JMEDesktopPane using code, too.

public class MyDialog extends BasicGameState implements lc.Disposable {
   public MyDialog(GameSettings gs, Services svcs) {
      handler = new InputHandler();
      desktop = new JMEDesktop("MyDialog", 400, 300, handler);
      rootNode.updateGeometricState(0.0f, true);
      rootNode.updateGeometricState(0.0f, true);
      DisplaySystem ds = (DisplaySystem)svcs.service("display");
      rootNode.getLocalTranslation().set(ds.getWidth() / 2, ds.getHeight() / 2, 0.0f);
      desktop.getJDesktop().setBackground(new Color(0, 0, 0, 0));

   public void dispose() {
      desktop = null;

   void buildLayout() {
      JDesktopPane jdp = desktop.getJDesktop();
      JInternalFrame frame = new JInternalFrame("My Window", false, false, false, false);
      frame.getContentPane().setLayout( new FlowLayout() );
      final JTextField textField = new JTextField( "Some Label" );
        frame.getContentPane().add( textField );
        frame.setSize(jdp.getWidth(), jdp.getHeight());
      try {
      catch (java.lang.Exception x) {

   InputHandler handler;
   JMEDesktop desktop;

Please, no jibes about catching java.lang.Exception and doing nothing with it.

Are you using PropertiesDialog, PropertiesDialog2 or LWJGLPropertiesDialog?

If you are using any AbstractGame subclass, you might do by calling setDialogBehaviour(ALWAYS_SHOW_PROPS_DIALOG).

All of the above classes set the look and feel back to system native, so you might want to set motif a little later - I usually setup ingame look and feel in initGame().

Ah! That would do it. Thanks!

Bonus points if you can point me to the location where this is documented (ideally in the JMEDesktopPane documentation page)  :smiley:

I think if at all it should be documented in the PropertiesDialog classes, and maybe every AbstractGame subclass - since that's where the unexpected behavior originates.

JMEDesktop is just rendered using the LnF that has last been set, which is exactly what I'd expect - it's not a bug, it's a feature!

While I understand that, the truth of the matter is that someone looking to start using JMEDesktop, and not getting the LnF he's expecting, will first look at the documentation for JMEDesktop. Even thinking to search for the PropertyDialog or AbstractGame classes for Swing-related stuff doesn't come obvious at all. According to the principle of the least surprise, the right place to start documenting it (or at least put an obvious pointer) would be in JMEDesktop. (I'm not against also putting docs in other places).

Of course, I don't use CVS, so I might as well wish for a pony while I'm at it  :slight_smile:

I've added a note into the JavaDoc of JMEDesktop.

Thank you very much. Whomever has the same problem after me will thank you, too :slight_smile: