This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes NX: when to use values from suncertify.properties Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "NX: when to use values from suncertify.properties" Watch "NX: when to use values from suncertify.properties" New topic
Author

NX: when to use values from suncertify.properties

Rick Lu
Ranch Hand

Joined: Mar 25, 2003
Posts: 47
Hi,
I am working on the client GUI. One tricky to me is that where to load values from the property file???
This is how my client gui work:
At the client side, there are two possibilities: �standalone� and nothing for network client. A dialog box will start. For �standalone� a textfield where the user can type in the location of the db-file; for the empty mode flag two textfields for the hostname and the port-number. Then, the dialog-box is closed and the GUI-client opens.
So, there seems no need to load persistent values because the dialog box always popup, right???
Thanks. Rick
[ November 07, 2003: Message edited by: Rick Lu ]

SCJD 1.4
Chris Harris
Ranch Hand

Joined: Sep 21, 2003
Posts: 231
Hi Rick,
I started a thread on exactly the same subject a few weeks ago. I agree with you that there are no need for default values.
Hope that helps
Chris


SCJP 1.2, SCWCD, SCBCD
Rick Lu
Ranch Hand

Joined: Mar 25, 2003
Posts: 47
Hi Chris,

I agree with you that there are no need for default values.

Sorry, maybe I didn't write it clear. My question is not only about default values. Actually, I want to know when we should use values in the property file.
As the dialog always popups, there seems the values perviously stored in the properties will neven be used! Do I need to ask user "whether you want to open last database you previously worked on?"? Any suggestion on this?
Thank you. Rick
Bharat Ruparel
Ranch Hand

Joined: Jul 30, 2003
Posts: 493
Hello Rick,
Here is what I did. I created dialog-boxes for each mode:
server
client
alone
Take alone for example: I show the dialog-box with the file name label and the text-box and a button alongside it to activate the JFileChooser dialog-box so that the user can navigate to the the data file graphically or type-in the path directly. This is what you save in the properties file. During the next run in alone mode, you simply display the value saved in the previous run in the text-box, the user has the option to re-select or res-specify the loction of the data file if it had been moved between the runs, or simply accept the location with a simple button click (Ok button).
I did the same thing for the other two options, i.e., the server option and the client option. The thing to do here is to name your properties so that you can distinguish which property belongs to which mode: for example I called the file location property "aloneFileLocation" for the alone mode and "serverFileLocation" for the server mode.
Another thing to keep in mind while designing the dialog-boxes is that you want to make sure that you create the suncertify.properties file if it doesn't exist in the current working directory. When you are ready to upload your project, you won't have to worry about how and where to include this file and also since the grader's machine and set-up most likely will be so different that yours that it doesn't make sense to include it in the first place (thanks Andrew).
Hope this helps.
Regards.
Bharat


SCJP,SCJD,SCWCD,SCBCD,SCDJWS,SCEA
Rick Lu
Ranch Hand

Joined: Mar 25, 2003
Posts: 47
Hello Bharat,
Thank you so much. That's exactly what I ask for.

When you are ready to upload your project, you won't have to worry about how and where to include this file and also since the grader's machine and set-up most likely will be so different that yours that it doesn't make sense to include it in the first place (thanks Andrew).

Yes, my program will create a property file when there is no such one.
Rick
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: NX: when to use values from suncertify.properties
 
Similar Threads
Rahul " The Architect " Mahindrakar is now also eclipsed Developer Cert Mountain
NX: suncertify.properties
RMI server IP/Port values
Question about properties file
NX: (Contractors) Do you guys hard code the port number?