Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

 
 
Thread Tools Display Modes
Prev Previous Post in Thread   Next Post in Thread Next
Old Apr 8th, 2007, 3:13 PM   #1
Riddick
Newbie
 
Join Date: Sep 2006
Posts: 14
Rep Power: 0 Riddick is on a distinguished road
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?
Riddick is offline   Reply With Quote
 

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

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




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 6:16 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC