473,473 Members | 2,316 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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

dmjpro
2,476 Top Contributor
plzzzz hellpppp me out
Apr 7 '07 #1
2 6773
JosAH
11,448 Recognized Expert MVP
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:
Expand|Select|Wrap|Line Numbers
  1. public class FooFilter implements FileFilter {
  2.    public boolean accept(File file) {
  3.       return file.getName().startsWith("foo");
  4.    }
  5. }
This filter only accepts files starting with "foo".

kind regards,

Jos
Apr 7 '07 #2
dmjpro
2,476 Top Contributor
ohhhhhhhhhhhhhh................

now i understood
Apr 7 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: King W.Wang | last post by:
Hi Java gurus, I've copied the following program from the book "Java by Examples". It compiles well with javac. But it does not run as expected. EXPECTED: It is expected that, when you input...
0
by: Put 030516 in email subj to get thru | last post by:
I'm trying to learn about Java MIDI programming. Specifically, I'm interested in playing with Java MIDI sequencers (all puns intended). I'm looking at...
1
by: Az Tech | last post by:
Hi people, (Sorry for the somewhat long post). I request some of the people on this group who have good experience using object-orientation in the field, to please give some good ideas for...
1
by: Fisch von Gestern | last post by:
I have tried to run the extension function/element examples provided with the Xalan-J download. I believe that my classpath is correct, and that my versions are up-to-date. However, I can't get...
2
by: Rory Plaire | last post by:
Hi, I've been working with the J# browser control. I understand that v1.1b is scriptable, but can't find any examples on how to do this. Can someone point me in the right direction? thanks,...
102
by: Xah Lee | last post by:
i had the pleasure to read the PHP's manual today. http://www.php.net/manual/en/ although Pretty Home Page is another criminal hack of the unix lineage, but if we are here to judge the quality...
3
by: Fab | last post by:
Hi ! Maybe somebody has used a GC - I think to Hans Boehm's one, but other, if any, are welcome -. I need to use a GC in order to program an interpreter for a functional language. Memory...
3
by: FinPingvin | last post by:
Hi! This code wont work properly, it returns true for showing all maps, but not any files. It is supposed to filter the JFileChooser to only show *.mp3 files. I have looked at it too long now, so...
3
dmjpro
by: dmjpro | last post by:
why these two interfaces povided as both serves same job? i mean what is the advantage of FilenameFilter over FileFilter? plz help. Kind Regards.
4
SammyB
by: SammyB | last post by:
Well, the weather did get warm and I got in two bike rides, the file chapter was a disappointment (just a whitewash of DataOutputStream), so I decided to try DataInputStream which was also easy, BUT...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.