Just wanted the correct interpretation of my requirement :-
the program must allow the user to specify the location of the database
I have interpreted this as providing the user with the facility to specify the path to the database BUT not the database file name and the database file name to use, is as per the file provided by Sun. In my case, "db-2x2".
Or should it be interpreted as the user should be able to specify the path to the database file AND also the name of the database file. "C:\suncertify\database\db_another"
Roberto Perillo wrote:the user also has to provide in a JTextField the entire database path
Have you considered a javax.swing.JFileChooser to allow the user to browse to the location of your file rather than just a text box?
(And yes, this is rhetorical, given you have passed )
Andrew Monkhouse wrote:Have you considered a javax.swing.JFileChooser to allow the user to browse to the location of your file rather than just a text box?
Hey, my good buddy Andrew!
For this project, I tried to keep things as simple as possible, you know... since it wasn't required, I just went with the JTextField.
Axel Leucht wrote:I want to add that I check that the file exists and is writeable as well.
Partner, this isn't really necessary...
JTextField vs JFileChooser? Depends JFileChooser will not need to file existence, wrong magic cookie value etc and the only real disadvantage is the file must on the same machine that you are running the app.
The JTextField would indeed need to check file existence, cookie value etc and the major advantage is the database file can practically be on another computer.
For example: CompA is your server, you can specify a file on CompB if you really like (within the LAN of course).
For me I used a JTextField and did all those checking BEFORE saving the configuration.