jFileChooser.setMultiSelectionEnabled(true) not enabling

I did exactly what it told me to do for allowing the usage and selection of multiple files. yet it is not allowing me to select multiple files from the JFileChooser GUI. I try holding down the mouse button to select, shift-click, ctrl-click, and nothing works. I am using JDK v6, so compilation is not the issue.

JFileChooser picker =new JFileChooser();

picker.setMultiSelectionEnabled(true);

int returnVal = picker.showOpenDialog(null);

if(returnVal == 0)

{

File[] selected= picker.getSelectedFiles();

...

}

[782 byte] By [Tweaklinga] at [2007-11-27 1:49:43]
# 1
> if(returnVal == 0)I don't think so!You might avoid this sort of error if you used the JFileChooser return state variables. In this case you want JFileChooser.APPROVE_OPTION.
pbrockway2a at 2007-7-12 1:15:25 > top of Java-index,Java Essentials,New To Java...
# 2
Either way works. It really does not matter to the program whether I use zero or the static APPROVE_OPTION that has the same value. This is not the cause of the problem. The problem is being able to select multiple files in the GUI.
Tweaklinga at 2007-7-12 1:15:25 > top of Java-index,Java Essentials,New To Java...
# 3

Sorry, I wasn't thinking. (Didn't know what value APPROVE_OPTION had and leapt to the wrong conclusion...)

Are you saying that you can actually make the multiple selections in the dialog? (Rather than you can make them but they don't appear as part of the selected[] array) Your code works OK when I try it - I can select multiple files (but not multiple files+directories) either with shift/control + left mouse click or shift/control + spacebar. What OS/Desktop Manager ar you using?

pbrockway2a at 2007-7-12 1:15:25 > top of Java-index,Java Essentials,New To Java...
# 4
I'm using Win XP and Eclipse 3.2 to produce the code, yet it is not allowing me to select both visually and otherwise.
Tweaklinga at 2007-7-12 1:15:25 > top of Java-index,Java Essentials,New To Java...
# 5
Try without Eclipse - your code works for me and allows multiple selections from Beanshell.
ChuckBinga at 2007-7-12 1:15:25 > top of Java-index,Java Essentials,New To Java...