Monday, August 5, 2002 02:00 AM
There should be many elaborate ways to achieve what you want.
Since you want this feature to be enabled/disabled you should keep a file that contains
application properties (something like prompt_on_startup -> true/false).
On startup you read this file, and if this property is
- true, then display a JDialog, containing a JTextField and a JPasswordField prompting
for a user name and a password, respectively. How you store/retrieve this password is up to you;
you could hard-code it, use file system/network, use a database (going from easiest, cheapest to
more sophisticated, harder, expensive). After verifying the password you should show your
- false, just show your JFrame
This is an outline of a solution, I am not including coding details.
You could check your JDK installation (under demo/jfc/TableExample) for an example on how
to display a dialog, validate a username/password and then show your main application.