Menu

#344 Remember previous image save directory

Enhancement
closed-fixed
9
2013-04-30
2013-02-09
David Benn
No

The save-image feature (for plots) should remember the last directory saved to! It's really annoying when saving multiple plots when it doesn't!

Discussion

  • David Benn

    David Benn - 2013-04-10

    What's slightly annoying is that JFreeChart has these methods:

    chart.doSaveAs();
    File dir = chart.getDefaultDirectoryForSaveAs();
    chart.setDefaultDirectoryForSaveAs(dir);

    but doSaveAs() returns void so you can't find out what path was selected in the file chooser. getDefaultDirectoryForSaveAs() only returns what is set with setDefaultDirectoryForSaveAs().

    But I don't want to set an arbitrary directory, I want to have the last directory saved to remembered! Short of trying to find a static hook in JFileChooser or somewhere else in the Java class library, I don't know whether this can be done at all!

    The most recent version of JFreeChart (1.0.14in 2011) has no change to this API that I can see. There is a however a new development version on github so that needs to be explored.

    What can be done however, is just to use a different method to write an image and a regular JFileChooser, e.g.

    ChartUtilities.saveChartAsPNG(File file, JFreeChart chart, ...)

     
  • David Benn

    David Benn - 2013-04-30

    Fixed in 2.15.1

     
  • David Benn

    David Benn - 2013-04-30
    • status: open --> closed-fixed
     

Log in to post a comment.