Solved

JFileChooser - multiple selections with mouse

Posted on 2009-07-01
6
1,241 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
Comment Utility
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
Comment Utility
afaik there isn't sorry
0
 
LVL 2

Assisted Solution

by:sirtam
sirtam earned 200 total points
Comment Utility
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 1

Author Comment

by:allelopath
Comment Utility
>>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
Comment Utility
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
Comment Utility
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
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.
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

744 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now