Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Fathi
How I Choose a folder
1 Answer(s)      4 years and 8 months ago
Posted in : Java Interview Questions


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.

Advertisement
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 can i open pdf file in assest folder in android application?
how can i open pdf file in assest folder in android application?  thanks
Advertisements
How to Choose a Dedicated Server?
How to Choose a Dedicated Server?  Hi, How to Choose a Dedicated Server? Tell me the tips for choosing a best dedicated server hosting company... choose a good dedicated server for hosting your applications. How to Choose
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
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 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
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
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
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
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
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 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
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 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 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 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
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
Folder in Java.
Folder in Java.  I have any problem how to make Folder in java program? Can Anybody help me in this part
Choosing the Outsource Vendor,Choose Right Vendor for Outsouring,How to Choose Outsourcing Vendor
savings versus how soon the vendor brings down costs- which is more important
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
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
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
Java get Folder Size
in the specified folder. filelist[i].length() - This method returns the length of files... Java get Folder Size       In this section, you will learn how to get the size
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 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 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
 

 

 

DMCA.com