Results 1 to 5 of 5
  1. #1
    Wurstbrot is offline Member
    Join Date
    Oct 2013
    Posts
    3
    Rep Power
    0

    Default FileChooser in web application

    Hey guys,
    I'm trying to embed a JFileChooser in an html form, but it doesn't open properly.
    If i run my program in debug mode, everything works fine, but after binding it to html, no file browse dialog pops up by clicking the button.

    I found an example on the web with an open source code, but everything I done compared to the JUpload app seems to be good.

    So, here is a part of the source, the action listener of the button which I already tested and the upload control class i created. I hope someone is able to help me.

    Java Code:
      public void jButtonBrowse_ActionPerformed(ActionEvent evt) {
        if ( fileChooser == null) {
          fileChooser = new UploadControl();
        } // end of if
        if ( fileChooser != null ) {
          fileChooser.showOpenDialog(new Frame());
        } // end of if      
      } // end of jButtonBrowse_ActionPerformed
    Java Code:
    import javax.swing.JFileChooser;
    
    public class UploadControl extends JFileChooser
    {
      public UploadControl()
      {
        super();
        setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
        setFileHidingEnabled(true);
        setMultiSelectionEnabled(true);
      }
    }
    Best regards and thanks in advance.
    Last edited by Wurstbrot; 10-18-2013 at 02:17 PM.

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,225
    Rep Power
    20

    Default Re: FileChooser in web application

    How did you "bind it to html"?
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  3. #3
    Wurstbrot is offline Member
    Join Date
    Oct 2013
    Posts
    3
    Rep Power
    0

    Default Re: FileChooser in web application

    With the applet tag. The applet loads properly, every control is visible, but by pressing the button the window doesn't pop up.

    PHP Code:
    		<applet
                        code="Uploader.class"
                        name="Uploader"
                        archive="Uploader.jar"
                        width="640"
                        height="300">
            </applet>

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,225
    Rep Power
    20

    Default Re: FileChooser in web application

    OK.
    Check the logs in the console.
    It could be a security thing, if your applet isn't signed.

    Could also be this bit:
    Java Code:
    fileChooser.showOpenDialog(new Frame());
    Not sure how that would work...it's supposed to be the parent of your JFileChooser (so the applet?) or null. Not just some random Frame.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  5. #5
    Wurstbrot is offline Member
    Join Date
    Oct 2013
    Posts
    3
    Rep Power
    0

    Default Re: FileChooser in web application

    Ahh I just needed to sign the applet, stupid me, thank you very much, now it's working :)

Similar Threads

  1. Help with fileChooser
    By sportinus in forum AWT / Swing
    Replies: 1
    Last Post: 05-25-2011, 09:43 PM
  2. FileChooser
    By Unsub in forum New To Java
    Replies: 7
    Last Post: 03-10-2010, 04:54 AM
  3. FileChooser
    By jperson in forum New To Java
    Replies: 2
    Last Post: 01-23-2010, 05:43 PM
  4. Filechooser
    By Joe2003 in forum New To Java
    Replies: 5
    Last Post: 02-26-2009, 08:51 AM
  5. FileChooser UI
    By heartysnowy in forum New To Java
    Replies: 5
    Last Post: 11-27-2008, 04:31 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
  •