Results 1 to 5 of 5

Thread: JFile Chooser

  1. #1
    karno is offline Member
    Join Date
    Mar 2010
    Posts
    16
    Rep Power
    0

    Default JFile Chooser

    hi..... iam just a beginer using NetBeans...
    I want to ask how to make JFile Chooser in Java NetBeans to be like File chooser interface in Windows ..?? :D

  2. #2
    Metalibi is offline Member
    Join Date
    Mar 2010
    Posts
    2
    Rep Power
    0

    Default

    I'm not sure if this is a Netbeans-question or a Swing-question, but:

    The FileDialog-class has a Windows-interface:
    Java Code:
    FileDialog fd = new FileDialog(parentFrame);
    fd.setLocation(50, 50);
    fd.setVisible(true);

  3. #3
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    Are you using NetBeans inbuilt UI class? Like JDialog and so on. If so you can easily drag-drop the controls and customize accordingly.

  4. #4
    sniffer139 is offline Member
    Join Date
    Feb 2010
    Posts
    19
    Rep Power
    0

    Default

    may i know how to add a filter in this file chooser..like allowing only .doc ,doc.x ,.txt files
    SNIFFER

  5. #5
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    Java Code:
        JFileChooser fileChooser = new JFileChooser(".");
        FileFilter filter = new ExtensionFileFilter("Files", new String[] { "DOC", "DOCX" });
        fileChooser.setFileFilter(filter);

Similar Threads

  1. File chooser internationalization problem
    By Astghik in forum AWT / Swing
    Replies: 10
    Last Post: 01-14-2010, 07:44 PM
  2. jfile - a library to get a file's mimetype
    By Rodel Viado in forum Advanced Java
    Replies: 1
    Last Post: 12-15-2008, 01:30 AM
  3. Color Chooser Demo
    By Java Tip in forum javax.swing
    Replies: 0
    Last Post: 06-27-2008, 08:48 PM
  4. [SOLVED] File chooser selecting file from directory...?
    By prabhurangan in forum AWT / Swing
    Replies: 12
    Last Post: 06-18-2008, 05:08 AM
  5. Using File Chooser
    By shaungoater in forum New To Java
    Replies: 0
    Last Post: 03-20-2008, 01:30 PM

Posting Permissions

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