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 ]
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
Joined: Mar 25, 2003
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
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
Joined: Mar 25, 2003
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