Swing and path

Discussion in 'Java' started by wbrzozow@gmail.com, Apr 16, 2008.

  1. Guest

    Hello
    I have the following problem. I have been writing a Swing application.
    In this application in several places I use JFileChooser. I try to
    find a pattern or a good solution for remembering path to directory
    for each place, where the JFileChooser was used. In order to meet my
    boss requirements my application after lunching should remember paths
    that were used before.

    I hope that is clear, because my English isn’t very good.

    Waldek
     
    , Apr 16, 2008
    #1
    1. Advertising

  2. On Apr 16, 2:14 pm, wrote:
    > Hello
    > I have the following problem. I have been writing a Swing application.
    > In this application in several places I use JFileChooser. I try to
    > find a pattern or a good solution for remembering path to directory
    > for each place, where the JFileChooser was used. In order to meet my
    > boss requirements my application after lunching should remember paths
    > that were used before.
    >
    > I hope that is clear, because my English isn’t very good.
    >
    > Waldek


    One approach could be to save it off as a properties file. Jakarta
    has an abundance of Java tools and they happen to have a property
    persistence tool: http://commons.apache.org/configuration/howto_properties.html

    You can save the properties file to a place on the user's computer and
    then load it when the program opens.

    Hope this helps!
    Dee Dee
     
    Valdeva Crema, Apr 16, 2008
    #2
    1. Advertising

  3. Roedy Green Guest

    On Wed, 16 Apr 2008 11:14:48 -0700 (PDT), wrote,
    quoted or indirectly quoted someone who said :

    >I have the following problem. I have been writing a Swing application.
    >In this application in several places I use JFileChooser. I try to
    >find a pattern or a good solution for remembering path to directory
    >for each place, where the JFileChooser was used. In order to meet my
    >boss requirements my application after lunching should remember paths
    >that were used before.


    see http://mindprod.com/jgloss/jfilechooser.html
    for the code
    --

    Roedy Green Canadian Mind Products
    The Java Glossary
    http://mindprod.com
     
    Roedy Green, Apr 16, 2008
    #3
  4. Well, u spelled launch wrong, but other than that you had good
    english. What you basically could do is every time the user selects
    ok and clicks a file you set a variable to what that file's directory
    was then when your program exits (you could put this code in the close
    method of a WindowListener on you main frame) you simply write the
    data to a log file. Then every time you program loads you can read
    this file in and set all your file dialogs to start at this directory
    or the last file chosen.
     
    Chase Preuninger, Apr 16, 2008
    #4
  5. Guest


    > I would use Preferences instead of doing this.  It's what they are meant
    > for.
    >



    I am thinking about advantages and disadvantages both solutions :
    Preferences and Apache Properties. I probably use Preferences, but a
    have only one question. Where the configuration data are stored in
    Linux, Unix system.
     
    , Apr 17, 2008
    #5
  6. Guest

    On 16 Kwi, 21:12, "Kenneth P. Turvey" <>
    wrote:
    > On Wed, 16 Apr 2008 11:30:29 -0700, Valdeva Crema wrote:
    > > One approach could be to save it off as a properties file.  Jakarta has
    > > an abundance of Java tools and they happen to have a property
    > > persistence tool:
    > >http://commons.apache.org/configuration/howto_properties.html

    >
    > > You can save the properties file to a place on the user's computer and
    > > then load it when the program opens.

    >



    I am thinking about advantages and disadvantages both solutions :
    Preferences and Apache Properties. I probably use Preferences, but a
    have only one question. Where the configuration data are stored in
    Linux, Unix system.
     
    , Apr 17, 2008
    #6
  7. schreef:
    > On 16 Kwi, 21:12, "Kenneth P. Turvey" <>
    > wrote:
    >> On Wed, 16 Apr 2008 11:30:29 -0700, Valdeva Crema wrote:
    >>> One approach could be to save it off as a properties file. Jakarta has
    >>> an abundance of Java tools and they happen to have a property
    >>> persistence tool:
    >>> http://commons.apache.org/configuration/howto_properties.html
    >>> You can save the properties file to a place on the user's computer and
    >>> then load it when the program opens.

    >
    >
    > I am thinking about advantages and disadvantages both solutions :
    > Preferences and Apache Properties. I probably use Preferences, but a
    > have only one question. Where the configuration data are stored in
    > Linux, Unix system.


    http://mindprod.com/jgloss/properties.html

    H.
    --
    Hendrik Maryns
    http://tcl.sfs.uni-tuebingen.de/~hendrik/
    ==================
    http://aouw.org
    Ask smart questions, get good answers:
    http://www.catb.org/~esr/faqs/smart-questions.html


    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v2.0.4-svn0 (GNU/Linux)
    Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org

    iD8DBQFIBzC/e+7xMGD3itQRApFmAJ9lsY+KOLCQBH/ThJq69+Xi9j4lmwCcDcmH
    iIwQR5ASlvp51t+GpfbfxPE=
    =uZ/n
    -----END PGP SIGNATURE-----
     
    Hendrik Maryns, Apr 17, 2008
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Big Daddy

    Java 1.2 Swing vs. Java 1.5 Swing

    Big Daddy, Apr 15, 2005, in forum: Java
    Replies:
    2
    Views:
    524
    Pete Barrett
    Apr 16, 2005
  2. mkrause
    Replies:
    0
    Views:
    701
    mkrause
    May 6, 2005
  3. lizard
    Replies:
    0
    Views:
    1,802
    lizard
    Jan 30, 2006
  4. S.T
    Replies:
    2
    Views:
    608
  5. Knute Johnson

    Swing is dead! Long live Swing.

    Knute Johnson, Feb 16, 2012, in forum: Java
    Replies:
    32
    Views:
    3,881
    Daniel Pitts
    Feb 29, 2012
Loading...

Share This Page