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




Have Programming Question? Ask it here!
 
 
 


Fathi
How I Choose a folder
1 Answer(s)      4 years and 5 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
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
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
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
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
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 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
Folder in Java.
Folder in Java.  I have any problem how to make Folder in java program? Can Anybody help me in this part
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
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
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
How to store user name,city,state,image path into database and image into folder using jsp
How to store user name,city,state,image path into database and image into folder using jsp  How to store user name,city,state,image path into database and image into folder using jsp
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
which part to choose.....
which part to choose.....  whether working in database is good for career or in coding
How to copy files from one folder to another based on lastmodified date - Java Beginners
How to copy files from one folder to another based on lastmodified date  I have to make a simple utility to copy files from a folder to another folder in the same hierarchy, without overwriting the existing.  hiimport
how to read 100 text files from a folder or directory and write the data into a single file.using java programming?
how to read 100 text files from a folder or directory and write the data into a single file.using java programming?  i have multiple(app..100) text files which has data in the form of intgers consisting of 3 columns and app..3000
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
List Information about folder
List Information about folder       This Example shows you how to show folder information. In this code we have used method of Folder class to retrieve information about
create folder
create folder  what code we should write as a web application that it create an empty folder on client's desktop
How do I upgrade mysql?
How do I upgrade mysql?  How do I upgrade mysql
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
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 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
URL folder download to local
URL folder download to local  I have a requirement to download all the folders and files inside from a SVN link to my local directory. Can you help how it could be done
i dont no how to solve it pls
i dont no how to solve it pls   Calculate and display the sum of all prime number from 1 to 100 covert in java system codes
Zip Folder Using Java
Zipping a Folder       In this example we are going to create a zip folder and all files contained in this folder are zipped by using java. Here we will learn how to compress files
How can I learn Java?
How can I learn Java?  Hi, I have just completed a course in HTML and C programming language. I have some programming experience in visual basic... programming. How can I learn Java? in shortest possible time. I mean I just want to begin
how should i can solve
how should i can solve  Web based program - Input - Person's contact details with Passport Number as Unique Key. Save data in to oracle / MySQL. Output - List of Persons saved in the database. Technology to be used - JSP
struts2 folder struture - Struts
struts2 folder struture  Hi, I just want to know the exact folder structure required for the struts2 application? Its urgent
Advertisements
 

 

 

DMCA.com