Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

JFileChooser

  Asked By: Bryant    Date: Jun 11    Category: Java    Views: 656
  

I develope a applet and I want to open JFileChooser in action of one Button.
I Write his code for it in actionPerformed method:
JFileChooser fileaddress = new JFileChooser();

      fileaddress.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
fileaddress.setDialogTitle("Open Your Files!");
int result = fileaddress.showOpenDialog(this);
if (result == JFileChooser.APPROVE_OPTION)
{
file = fileaddress.getSelectedFile();
txtaddress.setText(file.toString());

}

this open in the appletviewer in event of my button, but when i open my applet in html files,JFileChooser doesn't open in button event. what is the problem?

Share: 

 

5 Answers Found

 
Answer #1    Answered By: Rachael Ferguson     Answered On: Jun 11

see log to more inf and maybe setup policy

 
Answer #2    Answered By: Muhammad Evans     Answered On: Jun 11

what is the log and setup policy! please explain for me more!

 
Answer #3    Answered By: Kian Evans     Answered On: Jun 11

as ali already told you,
you can't use JFileChooser in unsgined applet.
you must use a signed applet  instead.

 
Answer #4    Answered By: Tomas Thompson     Answered On: Jun 11

see your event(actionPerformed) , trace it and find
when you clicking the button(simplicity on the top
of event code  place(System.out.print("Click Event");)
, that`s fire or not.
i think that you not registered event properly.

 
Answer #5    Answered By: Madeeha Malik     Answered On: Jun 11
 
Didn't find what you were looking for? Find more on JFileChooser Or get search suggestion and latest updates.




Tagged: