Two Laptop Bag*
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

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Canonical Path without an extension" Watch "Canonical Path without an extension" New topic

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?
Ranganathan Kaliyur Mannar

Joined: Oct 16, 2003
Posts: 1076

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.

Darryl Burke

Joined: May 03, 2008
Posts: 4523

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

Joined: Jun 19, 2010
Posts: 825

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.
jQuery in Action, 2nd edition
subject: Canonical Path without an extension
Similar Threads
File Browser
JFileChooser problem
Jtext highlight visited line s
passing string
Correctly implementing save with JFileChooser