give some examples on FilenameFilter and FileFilter in java ....

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dmjpro
    Top Contributor
    • Jan 2007
    • 2476

    #1

    give some examples on FilenameFilter and FileFilter in java ....

    plzzzz hellpppp me out
  • JosAH
    Recognized Expert MVP
    • Mar 2007
    • 11453

    #2
    Originally posted by dmjpro
    plzzzz hellpppp me out
    Both are used by several utitility components such as FileDialog and JFileChooser.
    Both interfaces define a single boolean method that determines wheter a certain
    file should be accepted for display (or inclusion in a List). It's up to you to
    build a small class that implements at least one of those interfaces.
    Here's an example:
    Code:
    public class FooFilter implements FileFilter {
       public boolean accept(File file) {
          return file.getName().startsWith("foo");
       }
    }
    This filter only accepts files starting with "foo".

    kind regards,

    Jos

    Comment

    • dmjpro
      Top Contributor
      • Jan 2007
      • 2476

      #3
      ohhhhhhhhhhhhhh ............... .

      now i understood

      Comment

      Working...