Java JFileChooser ERROR_OPTION
Syntax
JFileChooser.ERROR_OPTION has the following syntax.
public static final int ERROR_OPTION
Example
In the following code shows how to use JFileChooser.ERROR_OPTION field.
//from w w w . j a v a 2 s. co m
import javax.swing.JFileChooser;
public class Main {
public static void main(String[] argv) {
JFileChooser chooser = new JFileChooser();
int result = chooser.showOpenDialog(null);
switch (result) {
case JFileChooser.APPROVE_OPTION:
System.out.println("Approve (Open or Save) was clicked");
break;
case JFileChooser.CANCEL_OPTION:
System.out.println("Cancel or the close-dialog icon was clicked");
break;
case JFileChooser.ERROR_OPTION:
System.out.println("Error");
break;
}
}
}
Home »
Java Tutorial »
javax.swing »
Java Tutorial »
javax.swing »