Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / April 2008

Tip: Looking for answers? Try searching our database.

Swing and path

Thread view: 
wbrzozow@gmail.com - 16 Apr 2008 19:14 GMT
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
Valdeva Crema - 16 Apr 2008 19:30 GMT
On Apr 16, 2:14 pm, wbrzo...@gmail.com wrote:
> Hello
> I have the following problem. I have been writing a Swing application.
[quoted text clipped - 7 lines]
>
> 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
Kenneth P. Turvey - 16 Apr 2008 20:12 GMT
> 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
[quoted text clipped - 3 lines]
> You can save the properties file to a place on the user's computer and
> then load it when the program opens.

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

Signature

Kenneth P. Turvey <kt-usenet@squeakydolphin.com>

wbrzozow@gmail.com - 17 Apr 2008 09:26 GMT
> 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.
wbrzozow@gmail.com - 17 Apr 2008 09:27 GMT
On 16 Kwi, 21:12, "Kenneth P. Turvey" <kt-use...@squeakydolphin.com>
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
[quoted text clipped - 3 lines]
> > 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.
Hendrik Maryns - 17 Apr 2008 12:13 GMT
wbrzozow@gmail.com schreef:
> On 16 Kwi, 21:12, "Kenneth P. Turvey" <kt-use...@squeakydolphin.com>
> wrote:
[quoted text clipped - 9 lines]
> have only one question. Where the configuration data are stored in
> Linux, Unix system.

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

H.
Signature

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

Lew - 17 Apr 2008 12:41 GMT
> wbrzozow@gmail.com schreef:
>> On 16 Kwi, 21:12, "Kenneth P. Turvey" <kt-use...@squeakydolphin.com>
[quoted text clipped - 12 lines]
>
> http://mindprod.com/jgloss/properties.html

<http://java.sun.com/javase/6/docs/api/java/util/prefs/Preferences.html>
> The user of this class needn't be concerned with details of the backing store.

<http://java.sun.com/javase/6/docs/api/java/util/Properties.html>

Always go to the Javadocs first.

Signature

Lew

Roedy Green - 16 Apr 2008 20:39 GMT
>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
Signature


Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com

Chase Preuninger - 16 Apr 2008 23:20 GMT
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.
Lew - 17 Apr 2008 01:52 GMT
> Well, u spelled launch wrong, but other than that you had good

If you're going to correct someone's spelling, you should do it without
deliberate misspellings of your own.

Signature

Lew



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.