What's Here?
- Members: 244,295
- Replies: 693,157
- Topics: 113,166
- Snippets: 3,863
- Tutorials: 935
- Total Online: 910
- Members: 67
- Guests: 843
|
Includes a filter and actions based on selection
|
Submitted By: William_Wilson
|
|
Rating:

|
|
Views: 4,823 |
Language: Java
|
|
Last Modified: May 5, 2006 |
|
Instructions: implement this with a filter, to learn it I am using the Text_files filter previously written |
Snippet
[code]
//start path of displayed File Chooser
//display FILES_ONLY, DIRECTORIES_ONLY or FILES_AND_DIRECTORIES
chooser. setFileSelectionMode(JFileChooser. FILES_AND_DIRECTORIES);
//set the filter to be used
chooser.setFileFilter(new Text_files());
//display File Chooser and wait for action
int returnVal = chooser.showOpenDialog(view);
//OK/Open button pressed
File directory = chooser. getSelectedFile();
try{
//open and display the file with it's information stored in directory
}
//msg if opening fails
JOptionPane. showMessageDialog(view, "The File cannot be opened!",
}
}
[/code]
Copy & Paste
|
|
|
Be Social
Reference Sheets
Bye Bye Ads
Monthly Drawing
Top Contributors
Top 10 Kudos This Month
|