File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes Canonical Path without an extension Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Canonical Path without an extension" Watch "Canonical Path without an extension" New topic
Author

Canonical Path without an extension

Jacky Luk
Ranch Hand

Joined: Aug 02, 2012
Posts: 590

When I do this, the returned file name has no extension attached.
Any ideas how to fix it?
Thanks
Jack
Ranganathan Kaliyur Mannar
Bartender

Joined: Oct 16, 2003
Posts: 1076
    
  10

You have to post a SSCCE. For example, the posted code doesn't have ExtensionFileFilter or chartCanvas.

Basically, we should be able to copy the posted code, compile straightaway and then we would be in a position to run and reproduce the problem in our machines. That would end in a quick resolution.


Ranga.
SCJP 1.4, OCMJEA/SCEA 5.0.
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4527
    
    5

Jack Luk wrote:When I do this, the returned file name has no extension attached.
Any ideas how to fix it?

String concatenation?

Also, the JDK comes with a perfectly usable FileNameExtensionFilter. Have you been reinventing the wheel?


luck, db
There are no new questions, but there may be new answers.
Kemal Sokolovic
Bartender

Joined: Jun 19, 2010
Posts: 825
    
    5

Why are you handling selected file as it is of type String ?

If you have JFileChooser#getSelectedFile() method that returns File, you can find out whatever you need to know about the file selected - including it's path, name with extension, etc.


The quieter you are, the more you are able to hear.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Canonical Path without an extension