Link to home
Start Free TrialLog in
Avatar of petede
petede

asked on

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

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
ASKER CERTIFIED SOLUTION
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial