Results 1 to 4 of 4
  1. #1
    rabbia is offline Member
    Join Date
    Feb 2009
    Posts
    3
    Rep Power
    0

    Unhappy show only PNG file in FileChooser

    Hi,
    i wanna see only .png files when FileChooser open. can you plz help me. i have tried FileFilter but its not working and error is their.
    Thanks

  2. #2
    toadaly is offline Senior Member
    Join Date
    Jan 2009
    Posts
    671
    Rep Power
    6

    Default

    Before you show the dialog, do something like...

    Java Code:
    FileFilter filter = new FileFilter() {
      public boolean accept(File f) {
         return f.getName().endsWith(".png");
      }
    
      public String getDescription() {
         return "PNG";
      }
    };
    
    fileChooser.setFileFilter(filter);

  3. #3
    rabbia is offline Member
    Join Date
    Feb 2009
    Posts
    3
    Rep Power
    0

    Default

    i have solved the problem.

  4. #4
    rabbia is offline Member
    Join Date
    Feb 2009
    Posts
    3
    Rep Power
    0

Similar Threads

  1. Filechooser
    By Joe2003 in forum New To Java
    Replies: 5
    Last Post: 02-26-2009, 08:51 AM
  2. FileChooser UI
    By heartysnowy in forum New To Java
    Replies: 5
    Last Post: 11-27-2008, 04:31 AM
  3. How to Show Calendar
    By praveen.kb in forum AWT / Swing
    Replies: 2
    Last Post: 02-09-2008, 09:23 AM
  4. netbeans 6.0 not show commpunent or show blank page
    By fahimaamir in forum NetBeans
    Replies: 1
    Last Post: 01-26-2008, 07:20 AM
  5. show a RTF FORMAT
    By Jack in forum Advanced Java
    Replies: 2
    Last Post: 07-04-2007, 04:37 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
  •