![]() |
|
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
Newbie
Join Date: Sep 2006
Posts: 14
Rep Power: 0
![]() |
File extensions
Hi, i'm trying to add a file extension to a file when the user has typed in the filename without an extension (in a JFileChooser). I've managed to recognise that the file is missing an extension.
String extension = null;
String fileName = file.getName();
int i = fileName.lastIndexOf('.');
if(i > 0 && i < fileName.length() - 1)
{
extension = fileName.substring(i + 1).toLowerCase();
}And from here i can work out the required extension from the filefilters but i don't know how to rename the file before i save it. Can anyone help? |
|
|
|
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| OnlineTextEditor.Com! | Sane | Show Off Your Open Source Projects | 43 | Jun 16th, 2006 9:55 AM |
| add mutiple users to the smbpasswd file. | Pizentios | Bash / Shell Scripting | 3 | Oct 20th, 2005 1:48 PM |
| After execution - Error cannot locate /Skin File? | wchar | Visual Basic | 1 | Mar 5th, 2005 10:04 PM |
| airport Log program using 3D linked List : problem reading from file | gemini_shooter | C++ | 0 | Mar 2nd, 2005 5:12 PM |
| Structure char field to a disk file | ehab_aziz2001 | C++ | 0 | Feb 10th, 2005 3:42 PM |