somewhat new with java

T

thewhoracle

I'm using netbeans, and when i use a JFileChooser, it doesn't spawn
in a new window, like it does in C#. it just kind of sits in the
background and does nothing. So i was wondering if someone could point
me in the direction of or provide with some example code for creating a
JFileChooser in a new window.
 
O

Owen Jacobson

I'm using netbeans, and when i use a JFileChooser, it doesn't spawn in a
new window, like it does in C#. it just kind of sits in the background
and does nothing. So i was wondering if someone could point me in the
direction of or provide with some example code for creating a JFileChooser
in a new window.

Have you read the class docs for JFileChooser?
<http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/JFileChooser.html>

You haven't shown us any code, so we have no way of knowing what's going
wrong, but if I had to guess, I'd say somewhere you're using

JFileChooser someChooser = new JFileChooser (...);

and expecting a window to pop up. That's not how it works, as the example
at the API docs makes fairly clear.

someChooser.showOpenDialog (parentComponent);

, where parentComponent is a reference to a GUI component to act as the
new window's parent (which may be null, last I checked), will show the
chooser as a modal window, pausing execution of the program until the
chooser is dismissed by the user.

If that's not it, well, show your code.

Owen
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top