Solved

JFileChooser - multiple selections with mouse

Posted on 2009-07-01
6
1,293 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 60

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
Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

 
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 60

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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

In this post we will learn different types of Android Layout and some basics of an Android App.
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

617 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