• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Canonical Path without an extension

 
Jacky Luk
Ranch Hand
Posts: 634
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

When I do this, the returned file name has no extension attached.
Any ideas how to fix it?
Thanks
Jack
 
Ranganathan Kaliyur Mannar
Bartender
Posts: 1101
10
Java Netbeans IDE Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Bartender
Posts: 5148
11
Java Netbeans IDE Opera
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Kemal Sokolovic
Bartender
Posts: 825
5
Java Python Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic