Paul (firstname.lastname@example.org) (email@example.com) writes:
I can't use File.list( FilenameFilter ). How do you use FilenameFilter?
The java.io.File class is an excellent representation of a file. But what
happens if you instantiate a File object with a directory name instead of a
file name? Not much, but it does allow you to use the list() method. list()is
a very cool method. It retrieves the names of all the files in the directory
specified at construction. They are returned to you in a String array. This
array can then be used to fill a List, or other AWT component, to present a
file list to the user.
Listing 1 opens a directory and retrieves the names of the files in it.
But what if you only want files of a certain type to be in your listing? You
can always parse through the returned array and remove the unwanted files.
But there is another, easier way! It is the Filen... (more)
John Hillenbrand (firstname.lastname@example.org) writes:
How can I make an AWT form in Java that responds correctly to the TAB key to
move the focus from field to field?
One of the nice features of many GUI platforms today is the use of the TAB
key to hop from field to field. It is one feature that Java is lacking. But
with a little finesse, you can make Java jump at your command.
If you look in the Java source code you will find that there is some
low-level support for this behavior. However, it does not work in the Windows
95/NT version of the Java Virtual Machine (JVM).
Below is a code sn... (more)
Scott McLaughlin (email@example.com) writes:
Could you explain to me what is meant by the term API, application
programming interface? I've programmed a little in C++ and am trying to teach
myself Java. I see API used all the time. What is it and how does it fit into
the programming picture?
Traditionally, programming languages are just that, languages. They have a
syntax and grammar that must be followed. Java is no different. However, the
creators of Java added value to the base language itself. This value is in
the form of extra features.
In order to utilize these features, you mu... (more)
Welcome to the Java Q&A Column. Hopefully, this column will evolve into an
excellent source of tips and techniques that you'll use over and over again.
In each issue, I'll answer questions from readers like you, and offer
insights into new and cool things that I've come across in my Java travels.
Since this is a new column, and I don't have any questions yet, I'm going to
talk about a common confusion point when it comes to event handling in Java.
I hope you enjoy the discussion.
Java Events: True or False?
There seems to be a lot of confusion over the return value in event handler... (more)