Solved

JFileChooser - multiple selections with mouse

Posted on 2009-07-01
6
1,262 Views
Last Modified: 2013-11-23
I have a JFileChooser that has multiple selections enabled. The selections are made by clicking on one file, holding the shift key down, and clicking another file. Is there a way to select multiple files using only the mouse (not the shift key), by holding down the mouse button and dragging?
0
Comment
Question by:allelopath
6 Comments
 
LVL 59

Expert Comment

by:Kevin Cross
ID: 24758566
The only way I know of is the shift or ctrl + click to highlight a number of files beginning with the first you select and through the next you select with shift held down.  Holding ctrl allowing you to pick individual files at random.
0
 
LVL 92

Expert Comment

by:objects
ID: 24758576
afaik there isn't sorry
0
 
LVL 2

Assisted Solution

by:sirtam
sirtam earned 200 total points
ID: 24761813
As you see from the API, when marking and selecting files it will only return ONE objectt.
If you want a more strong file chooser you will either have to make it yourself or use one of the premade ones available though google.

Remember: JFileChooser is a SIMPLE mechanism.

Java 6 api - JFileChooser:
http://java.sun.com/javase/6/docs/api/javax/swing/JFileChooser.html
0
NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

 
LVL 1

Author Comment

by:allelopath
ID: 24763406
>>it will only return ONE object.
If that one object contains multiple files, no matter how selected, then all is well

>>use one of the premade ones available though google.
I'm not following you here. Google has an API with JFileChoosers?
0
 
LVL 59

Accepted Solution

by:
Kevin Cross earned 300 total points
ID: 24763781
Simple answer is that JFileChooser doesn't do this at all as far as I know, so answer is NO to your question.
If the thought is to be able to select multiple files using just the mouse, you can take a look at other API's/implementations that may help which is what sirtam may have been eluding too.

One approach is to implement something like this example which allows you to make selections through check boxes.  Since you can check a box with mouse only, would get you to your goal.

http://www.java2s.com/Code/Java/Swing-JFC/FileSystemTree.htm
0
 
LVL 1

Author Comment

by:allelopath
ID: 24763841
mwvisa1:
I understand that the answer is NO, but I was confused by sirtam's response in that his point that it returns one object seemed irrelevant and that I don't know he meant by "available through google"

I'll take a look at the FileSystemTree.
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
map related example 6 49
Android development question 2 37
going to wrong jsp page 2 21
Html Table Looping (part 2) 5 9
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question