Java Reference
In-Depth Information
8
public static void
main(String[] args)
throws
IOException
9
{
10
JFileChooserDemo application =
new
JFileChooserDemo();
11
application.setSize(
400
,
400
);
12
application.setDefaultCloseOperation(
JFrame.EXIT_ON_CLOSE
);
13
application.setVisible(
true
);
14
}
15
}
// end class JFileChooserTest
a) Use this dialog
to locate and
select a file or
directory
Click
Open
to
submit file or
directory name
to program
Files and
directories are
displayed here
b) Selected file's or
directory's information;
if it's a directory, the
contents of that
directory are displayed
Fig. 15.13
|
Testing class
FileDemonstration
. (Part 2 of 2.)
This section overviews additional interfaces and classes (from package
java.io
).
InputStream
and
OutputStream
are
abstract
classes that declare methods for performing
byte-based input and output, respectively.
Pipe Streams
Pipes
are synchronized communication channels between threads. We discuss threads in
Chapter 23. Java provides
PipedOutputStream
(a subclass of
OutputStream
) and
Piped-