What's Here?
- Members: 131,964
- Replies: 470,238
- Topics: 72,883
- Snippets: 2,538
- Tutorials: 664
- Total Online: 2,046
- Members: 92
- Guests: 1,954
Who's Online?
|
Includes a filter and actions based on selection
|
Submitted By: William_Wilson
|
|
Rating:
  
|
|
Views: 3,571 |
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
|
|
|
Reference Sheets
Bye Bye Ads
Free DIC T-Shirt
Related Sites
Monthly Drawing
Partners
Top Contributors
Top 10 Kudos This Month
|