• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Browse/Upload Button

 
Jim Cutler
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do you create a "Browse/Upload" Button in Java? I want to be able to click on the "Browse" button, upload a folder of files, and have that pathname stored into a textfield.

What do I put under my actionPerformed() method?
 
Stephan van Hulst
Bartender
Pie
Posts: 4826
34
Chrome Netbeans IDE Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check out JFileChooser.
 
Maneesh Godbole
Saloon Keeper
Posts: 10971
11
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bill ForJoe wrote:


Please check your private messages for an important administrative matter.
 
Jim Cutler
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do I upload a folder of files? FileChooser only allows me to upload one individual file.
 
pete stein
Bartender
Posts: 1561
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jim Cutler wrote:How do I upload a folder of files? FileChooser only allows me to upload one individual file.


You can use it to get a File or an array of File. Please look at the API for File and you'll see that it can represent a single File or directories. In fact the very first line in the API states that File is:
An abstract representation of file and directory pathnames.


So it should work fine for you if you let it.
 
Stephan van Hulst
Bartender
Pie
Posts: 4826
34
Chrome Netbeans IDE Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm a doctor, Jim...

Did you read the documentation?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic