JFileChooser into the JMEDesktop

I need to get a JFileChooser into the JMEDesktop. Does anyone know of a good way to accomplish this?


No :frowning:

On most systems (esp. Mac) this does not work very well as large parts of the file choosers are system dependent heavyweight components and can't be drawn to bitmaps/textures.

If you still get it to work properly let us know…

Oh, then what steps should I take when using the JFileChooser? Is there a way to temporarily disable or minimize the jME app while using the JFileChooser?

As it is now it freezes if in fullscreen mode while tryaing to open a JFileChooser. And in windowed mode the filechooser appears in front but doesn't react to any mouse input.

Why not just create the JFileChooser and add it as a component instead of relying on it to do the popup itself?  Just do something like:

JFileChooser chooser = new JFileChooser();

Unless I'm missing something, it should work just like any custom component.

darkfrog said:

Unless I'm missing something

, maybe 'missed' the first two posts in this thread? :P

@rik: I have seen it working in a separate window (not fullscreen mode), but I don't know what those people did... did you use JFileChooser.showXY methods?

I assume you mean the showOpenDialog(), showSaveDialog() or showDialog. As far as I know you have to call one of these to use the JFileChooser. It always pops up in a seperate window.

For now I use display.recreateWindow() to switch to windowed mode before calling showOpenDialog and then recreateWindow back to fullscreen again. (Of course only if it wasn't already windowed).

That works but it looks quite ugly and is slow. It would really be nice to open the JFileChooser directly in JMEDesktop.

Btw, is there a better way to do this than using recreateWindow?

Maybe you should have tried my code example because you don't have to call a show method at all, they are just convenience methods in order to display the JFileChooser component.  The JFileChooser is just rarely dropped in as a component and usually needs to be in a popup window.  In your case if you just try the code example I posted above you should be g2g. :-p


Wow, it accually works inside the internalframe. I thought I had tried it but thats just because I suck at Swing. After messing with the setSize setVisible etc it finally popped up.

Hehe, will that do everything you need it to do now?  I had intended to mess around with it, but hadn't gotten around to it yet.


We'll see, I hope so. Thanks. :slight_smile:

I'm a little concerned about what irrisor wrote though. Will this be unpredictable in other systems?

Well at least I was told that it shows only the buttons on Mac :|.

Externally it works ok for me in RenParticleEditor…

Then unless Irrisor did some hoaky things with JMEDesktop integration then it should be fine. :wink:


err, no, darkfrog, JMEDesktop paints the components to an image which is not supported for heavyweight components. That's why there is a difference between a normal swing application (e.g. extra dialog) and the stuff shown ingame as a texture. That's why it is highly OS, VM and L&F dependent what is working within JMEDesktop.