Solved

Open file Browse

Posted on 1998-06-16
8
218 Views
Last Modified: 2010-04-16
How can make Open dialog brows to select a file or directory ?
0
Comment
Question by:a_sameer
  • 5
  • 3
8 Comments
 
LVL 5

Expert Comment

by:msmolyak
ID: 1223278
What exactly you are trying to do? Is java.awt.FileDialog what you want?
0
 

Author Comment

by:a_sameer
ID: 1223279
That's ok , But how can write this code in HTML
and where can found the class of this function .

Thanks ,,,
0
 
LVL 5

Accepted Solution

by:
msmolyak earned 150 total points
ID: 1223280
The easiest thing to do is to use JavaScript. Alas, that would work only in Netscape Navigator 3.x and above.

<SCRIPT LANGUAGE="JavaScript">

var fileName;

/**
 * Display a file dialog and return a selected file.
 */
function getFile()
{
    var parentFrame = new java.awt.Frame();
    var fileDialog = new java.awt.FileDialog(parentFrame, "Select a file to print");
    fileDialog.setVisible(true);
    fileName = fileDialog.getDirectory() + fileDialog.getFile();
    alert("Selected file " + fileName);
}
</SCRIPT>

The necessary classes come with Netscape's Java support and you should not have to do anything to install these classes.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:a_sameer
ID: 1223281
ok , that's very good ... Thanks Msmolyak.

But I'm sorry ,, I want to select a Directory only (such as Empty Directory How can select it ?)



0
 

Author Comment

by:a_sameer
ID: 1223282
ok , that's very good ... Thanks Msmolyak.

But I'm sorry ,, I want to select a Directory only (such as Empty Directory How can select it ?)



0
 
LVL 5

Expert Comment

by:msmolyak
ID: 1223283
I am afraid AWT does not posess this capability. It is possible, JavaScript has built-in functions to do that, I am not that familiar with JavaScript.  I will check what Swing has in that respect. I know Swing has a FileChooser but first of all it's in a preview stage, then I am not sure whether it can select directories and finally unlike AWT, Swing classes do not come with the browser so it will be harder to use them from JavaScript,
0
 
LVL 5

Expert Comment

by:msmolyak
ID: 1223284
Swing;s FileChooset does not seem to support that either, which is only logical. It's hard to use the same interface for selecting both files and directories since double click ona file means "Select", whicl double click on a directory means "Expand". The oly place where I've seen directory selection dialogs is InstallShield when it asks you for the installation directory.
0
 
LVL 5

Expert Comment

by:msmolyak
ID: 1223285
I'll take my last statement back. Swing's FileChooser does allow to choose directories only according to its description.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Configure a Bean in an XML file 4 49
servlet web applications   metadata-complete="true" or false 3 201
hibernate example using maven 12 82
Setup GlassFish 4 37
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
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 learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…

730 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