?
Solved

Im trying to write an applet with JFileChooser, so the user can browse the harddrive and click on a file as input

Posted on 2003-03-12
1
Medium Priority
?
204 Views
Last Modified: 2010-03-31
I have an applet written that allows the user to type the input, the input is then used to parse a file.  I need to have the user to be able to browse for a file on the hard drive, and this then to be used again as input to be parsed. When I try this I get various security issues. Would it be possible for  someone to give me some advice on how to go about this.

Thankyou.


import java.awt.*;

//-------------------------------------------------------------------
//  Main applet class

public class FileApplet extends java.applet.Applet {

  public void init() {
   
     add(new Button("Load File"));
 
  }//init

  public boolean action(Event x,Object arg) {
   
     if (x.target instanceof Button && ((String)arg).equals("Load File")) {
            ParsePDB pPDB = new ParsePDB();
            pPDB.other();
     }//if
     return true;
  }//action

  //  These methods allow the applet to also run as an application.

  public static void main(String args[]) {
   
            ParseFile pFILE = new ParseFile();
            pFILE.another();
     
  }//main
 
}//FileApplet
0
Comment
Question by:petede
1 Comment
 
LVL 86

Accepted Solution

by:
CEHJ earned 1500 total points
ID: 8119161
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Don’ts and Dos are two important end products of software testing basics that a tester needs to regard. This article attempts to explain the principles of both.
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
Suggested Courses
Course of the Month9 days, 13 hours left to enroll

609 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