Ich verstehe eine angabe in der API nicht. Könnt ihr mir da weiterhelfen?
http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/JFileChooser.html
Ich bin in Englisch nicht so gut, verstehe zwar was da steht, kann aber nichts damit anfangen. Welche Klasse muss ich denn nun genau importieren, damit ich ExampleFileFilter aufrufen kann? (Fettgedrukte Codestelle)[/b]
http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/JFileChooser.html
Code:
JFileChooser provides a simple mechanism for the user to choose a file. For information about using JFileChooser, see How to Use File Choosers, a section in The Java Tutorial.
The following code pops up a file chooser for the user's home directory that sees only .jpg and .gif images:
JFileChooser chooser = new JFileChooser();
[b]// Note: source for ExampleFileFilter can be found in FileChooserDemo,
// under the demo/jfc directory in the Java 2 SDK, Standard Edition.[/b]
ExampleFileFilter filter = new ExampleFileFilter();
filter.addExtension("jpg");
filter.addExtension("gif");
filter.setDescription("JPG & GIF Images");
chooser.setFileFilter(filter);
int returnVal = chooser.showOpenDialog(parent);
if(returnVal == JFileChooser.APPROVE_OPTION) {
System.out.println("You chose to open this file: " +
chooser.getSelectedFile().getName());
}
Ich bin in Englisch nicht so gut, verstehe zwar was da steht, kann aber nichts damit anfangen. Welche Klasse muss ich denn nun genau importieren, damit ich ExampleFileFilter aufrufen kann? (Fettgedrukte Codestelle)[/b]