Results 1 to 7 of 7
  1. #1
    ki_ha1984 is offline Senior Member
    Join Date
    Aug 2011
    Posts
    118
    Rep Power
    0

    Default jfilechooser empty selection area in java applet

    Hi,

    i built an java applet which works well in netbeans but when i export it and run it as web application the jfilechooser doesnot work it is empty like you can see in the next figure.

    jfilechooser empty selection area in java applet-untitled.png

    the code associated to a brows button i used is the below

    Java Code:
    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                         
            // TODO add your handling code here:
            JFileChooser fc = new JFileChooser();
            int returnVal = fc.showOpenDialog(this);
    
            if (returnVal == JFileChooser.APPROVE_OPTION) {
                File file = fc.getSelectedFile();
                String g = file.getAbsoluteFile().toString();
                System.out.println("|->"+g);
            } else {
                System.out.println("Open command cancelled by user.");
            }
        }
    Any idea?

    Thank you in advance

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    20,003
    Rep Power
    33

    Default Re: jfilechooser empty selection area in java applet

    Are there any error messages in the java console?

    Normally applets are not allowed to look at a user's files.
    If you don't understand my response, don't ignore it, ask a question.

  3. #3
    ki_ha1984 is offline Senior Member
    Join Date
    Aug 2011
    Posts
    118
    Rep Power
    0

    Default Re: jfilechooser empty selection area in java applet

    Quote Originally Posted by Norm View Post
    Are there any error messages in the java console?

    Normally applets are not allowed to look at a user's files.


    No there is no error in java console.

    How i will fix this error, because i need to get the selected file directory.

  4. #4
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    6,226
    Rep Power
    14

    Default Re: jfilechooser empty selection area in java applet

    Why are you running this as an applet?

    Regards,
    Jim
    The JavaTM Tutorials | SSCCE | Java Naming Conventions
    Poor planning on your part does not constitute an emergency on my part

  5. #5
    ki_ha1984 is offline Senior Member
    Join Date
    Aug 2011
    Posts
    118
    Rep Power
    0

    Default Re: jfilechooser empty selection area in java applet

    Quote Originally Posted by jim829 View Post
    Why are you running this as an applet?

    Regards,
    Jim
    because i have to have it online.

    Any idea?

  6. #6
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    20,003
    Rep Power
    33

    Default Re: jfilechooser empty selection area in java applet

    Can you make a Short, Self Contained, Correct Example and post it for our testing to see what happens?
    If you don't understand my response, don't ignore it, ask a question.

  7. #7
    ki_ha1984 is offline Senior Member
    Join Date
    Aug 2011
    Posts
    118
    Rep Power
    0

    Default Re: jfilechooser empty selection area in java applet

    Thank you very much, but finally i found a solution alone.

    I build the application as a single jar file, not as applet, then i sign it and last i call the GUI class from html and finally it worked for me.

    Thank you again.

Similar Threads

  1. How to add a new empty line in an applet?
    By thamizhsmith in forum New To Java
    Replies: 9
    Last Post: 08-19-2012, 11:48 AM
  2. Replies: 11
    Last Post: 05-11-2012, 02:19 PM
  3. Replies: 0
    Last Post: 04-26-2012, 11:50 AM
  4. only ~200x200px Applet area visible
    By jumper19 in forum New To Java
    Replies: 8
    Last Post: 02-02-2009, 03:05 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •