How I Choose a folder

How I Choose a folder

Thanks my friend for your answer,

Perhaps i do not explain clearly my question. I know how I get files from a folder.

My question How I select a folder.

From this selected folder i get the files.

I know how I get files but the problem How I choose a folder.

Thanks a lot for your helpful.
View Answers

April 7, 2010 at 5:09 PM

Hi Friend,

Try the following code:

import javax.swing.*;
import java.io.*;

public class ChooseFolder
{
public static void main(String[] args)
{
JFileChooser chooser = new JFileChooser();
chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
if (JFileChooser.APPROVE_OPTION==chooser.showDialog(null, "Select"))
{
File dir = chooser.getSelectedFile();
System.out.println(dir);
}
System.exit(0);
}
}

Thanks









Related Tutorials/Questions & Answers:
How I Choose a folder - Java Interview Questions
. I know how I get files but the problem How I choose a folder. Thanks...How I Choose a folder  Thanks my friend for your answer, Perhaps i do not explain clearly my question. I know how I get files from a folder
How do I choose a data science course?
How do I choose a data science course?  I am thinking of getting trained in data science. How do I choose a data science course? There are many... How do I choose a data science course? Thanks
Advertisements
how can i open pdf file in assest folder in android application?
how can i open pdf file in assest folder in android application?  thanks
What major should I choose for data science?
What major should I choose for data science?  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: What major should I choose for data science? Try to provide me good
How to Choose a Dedicated Server?
How to Choose a Dedicated Server?  Hi, How to Choose a Dedicated... in choosing a bad host. But with a little search and dedication you can choose a good dedicated server for hosting your applications. How to Choose a Dedicated Server
i want to save image on server folder. and i want to save URL of this folder and name of image in database
i want to save image on server folder. and i want to save URL of this folder and name of image in database  hi i want to save image on server folder. and i want to save URL of this folder and name of image in database.on click
how to set folder size in php
how to set folder size in php  hi , i know how to create folder but i dont know how to set size for folder did u know means tell me. thankyour
Where can I find reviews of IT solutions company in India to choose from?
Where can I find reviews of IT solutions company in India to choose from?  Where can I find reviews of IT solutions company in India to choose from
how to download a file from a folder??
how to download a file from a folder??  i can upload any kind of files to a folder, and only the path of the file is saved into the database, now how a client can download the file from my folder. pls provide me the jsp code
which database and programming language i should choose - Framework
good JSP programmer so i want to know which one i choose from ASP.NET and PHP... help me to choose the best database and programming languages.finally i appreciate...which database and programming language i should choose  Hi, I am
I don't found in Tomcat 7.0 's bin folder..
I don't found in Tomcat 7.0 's bin folder..  While making servlet using tomcat 7.0, i don't find startup.bat file in bin folder. My servlet... know how to run my servlet even i am following all the steps
how to browse folder and directory in jsp
how to browse folder and directory in jsp  how to browse folder... but dont know how to get files after that.and also i want to show limited directories based on last modified date for eg:if the directory contains 10 folders i need
How to make a folder icon, make a folder icon, folder icon
How to make a folder icon       The folder is used in the computer, this example will teach you to design technique of the folder.  New File: Take a new file as your folder
Chmod 777 to a folder and all contents
Chmod 777 permission - Chmod 777 to a folder and all contents In this tutorial I am going to show you the use of the chmod command for changing the folder... of a directories.ADS_TO_REPLACE_2 How to Chmod 777 to a folder and all contents? Suppose you
Choose a class
Choose a class  Hi, I am working with java. I was wondering what to type in the start of a program so I can choose between all the classes in the program? How to choose to use only "class A" for example? Thanks for a quick
How to copy an jpeg image from one folder to other folder using jsp
How to copy an jpeg image from one folder to other folder using jsp  hello, i am creating photo gallery where from admin side i allow admin to browse... be in my image folder...so,How to copy an jpeg image from one folder to other
how to download the uploaded folder files using jsp
how to download the uploaded folder files using jsp  how to download the uploaded folder files using jsp
how to backup files and folder with Java
how to backup files and folder with Java  Does anyone know to create a backup with java?. backup files and folders from my computer to an external...:\\Documents and Settings\\bharat\\Desktop\\bipul\\New Folder\\TableExample.java
how to search a text in all files in a folder in unix
how to search a text in all files in a folder in unix  Hi, I am using ubuntu and my need is to find all the files containing a text say "India". How... a text in all files in a folder in unix? Thanks   Hi, I Ubuntu or any
how to search a text in all files in a folder in unix
how to search a text in all files in a folder in unix  Hi, I am using ubuntu and my need is to find all the files containing a text say "India". How... a text in all files in a folder in unix? Thanks   Hi, I Ubuntu or any
how to search a text in all files in a folder in unix
how to search a text in all files in a folder in unix  Hi, I am using ubuntu and my need is to find all the files containing a text say "India". How... a text in all files in a folder in unix? Thanks   Hi, I Ubuntu or any
how to search a text in all files in a folder in unix
how to search a text in all files in a folder in unix  Hi, I am using ubuntu and my need is to find all the files containing a text say "India". How... a text in all files in a folder in unix? Thanks   Hi, I Ubuntu or any
how to upload a file of apk format in a folder from servlet
how to upload a file of apk format in a folder from servlet  How to upload a file of apk format to a folder from servlet, i am trying to do, its getting uploaded as .zip file and not apk file
How to copy an jpeg image from one folder to other folder using jsp
How to copy an jpeg image from one folder to other folder using jsp  How to copy an image from one folder to another folder using jsp
Folder in Java.
Folder in Java.  I have any problem how to make Folder in java program? Can Anybody help me in this part
Java sdk/java poi hssf code to creat excel with folder structure,( i,e folders, subfolders and childrens )
Java sdk/java poi hssf code to creat excel with folder structure,( i,e folders, subfolders and childrens )   I need to create a folder structure... . i need some help in getting folder structure using this java . Folder
Jsp Choose
Jsp Choose          In this section, you will learn how to use JTSL choose tag.  In the given example, the c:if tag is used for a decision need
How to upload and save a file in a folder - Java Beginners
How to upload and save a file in a folder  Hi How to upload and save a file in a folder? for example Agreement.jsp File: So when...; Hi Friends, I need that code using servlets and jsp..... Please let me
how to upload multiple files in jsp and saving the path in database and the file in folder
how to upload multiple files in jsp and saving the path in database and the file in folder  how to upload multiple files in jsp and saving the path in database and the file in folder I have created a form for the upload of files
I want to Transfer only 1/3rd of contents from one folder to other but my code is transferring all contents
I want to Transfer only 1/3rd of contents from one folder to other but my code...("No files in directory: " + src); } for (int i = 0; i < entries.length; i++) { File file = entries[i
How can store image in server folder when deployed with a .war file?
How can store image in server folder when deployed with a .war file?  Hi all; When I am using application.getRealPath() , it return null when deployed with a .war file and when I use hard code it shows syntax error or path
How to Choose Jewelry?
How to Choose Jewelry? From the man perspective it might seem like choosing... that I spent several hours shopping for a new set of earrings with my girlfriend just to leave the mall empty handed. After all these experiences I came
files that are present in any folder , how to make it clickable downloadble file in php
files that are present in any folder , how to make it clickable downloadble file in php   files that are present in any folder , how to make it clickable downloadble file in php
How to store multiple images in folder and images path in database at a time using jsp?
How to store multiple images in folder and images path in database at a time using jsp?  I wanna browse multiple images in one form and store them in one folder and their path into datrabase
How to extract a zip file to a folder in Linux?
How to extract a zip file to a folder in Linux? Step by step command with example to extract a zip to specified folder In this tutorial we are going... want to extract to a specified folder instead of extracting to same folder
Zipping folder - Java Beginners
Zipping folder  sir, as the part of my academic project, i need to zip a user selected folder . this folder may contain any number of folder and sub folders. i saw an example in this site showing , how to zip a folder, i executed
how can i display a pdf file in a jtextarea
how can i display a pdf file in a jtextarea  I need to display a pdf file in a jtextfield or in a jtextarea.Atlest i need to displat it in a jframe.I have a button and while clicking on it ,i need to choose the pdf file and need
ModuleNotFoundError: No module named 'choose'
'choose' How to remove the ModuleNotFoundError: No module named 'choose'...ModuleNotFoundError: No module named 'choose'  Hi, My Python... to install padas library. You can install choose python with following command
How to access the image file from project folder itself while writing to pdf using itext?
How to access the image file from project folder itself while writing to pdf... to search for the image in the domain folder of the glassfish location.But i want it to pick it up from the project folder itself.Because later i deploy the project
How to open excel sheet when excel file is placed in some folder in desktop
How to open excel sheet when excel file is placed in some folder in desktop  How to open an excel sheet using windows.open in IE... I am getting an error msg that the path is not correct.. But i have specified the correct path
How to find the exact PHP template I need?
How to find the exact PHP template I need?  Hi! I'm a PHP Pro?I think I am one?, but this is the first time for me to try a PHP template, so I have no clue on how to choose one. Do you have some tips to help me choose
How should I learn coding?
How should I learn coding?  Hello Programmers, How should I learn coding? I want to start it from beginning. Its better if someone provides me urls... towards making your career in programming. You can choose any of following
Choosing the Outsource Vendor,Choose Right Vendor for Outsouring,How to Choose Outsourcing Vendor
with broad capabilities? The total savings versus how soon the vendor brings down
create a folder in jsp page
create a folder in jsp page  i want to create a folder in jsp page And it can be delete aslo
How to copy files from one folder to another based on lastmodified date - Java Beginners
Copy files from one folder to another  How to copy files from one folder to another based on lastmodified date
How do I upgrade mysql?
How do I upgrade mysql?  How do I upgrade mysql
Virtualbox shared folder permissions error
Virtualbox shared folder permissions error  Hi, I am running Oracle... as of the guest os. I have shared a folder from my windows computer to the Virtual box vim. The mapping for this folder appears inside the VM but I am not able
how i connect two page
how i connect two page  strong textlink text
How can I do it? .click();
How can I do it? .click();  I have a very unusual problem. I want...("a"); x.click(); </script> So it's click on an element witch one Id's is "a", but I want that it make mouseup in this element. How can I do it, because if I write
how to store image in folder and stored image path in mysql database using JSP
how to store image in folder and stored image path in mysql database using JSP  how to store image in folder and stored image path in mysql database using JSP

Ads