borland Packages Class Hierarchy dbswing Package
java.lang.Object +----com.borland.dbswing.DBPasswordPrompter
Constructors Properties Methods
Implements ActionListener, Serializable, EventListener
DBPasswordPrompter
prompts a user for a password to access a DataExpress Database
and opens the connection to the database. To display DBPasswordPrompter
, call its showDialog()
method early in an application before any data-aware components attempt to open the database automatically.
You can provide a default user name or password by setting the userName
and password
properties. By default, a user is allowed to enter three invalid passwords before DBPasswordPrompter
automatically closes. You can change the maximum number of attempts by setting the maxAttempts
property. You must also set the database
property to reference the com.borland.dx.sql.dataset.Database
database to be accessed, and set the frame
property to a parent Frame
for the dialog box.
Call DBPasswordPrompter's
showDialog()
method to prompt a user for a username and password. The showDialog()
method returns a true
value and opens the database connection if the user entered a valid password. Otherwise, showDialog()
returns a value of false
, and the database connection remains unopened.
public DBPasswordPrompter()Constructs a
DBPasswordPrompter
. If you use this constructor, you must remember to set the frame
and database
properties before displaying the password dialog box.
public DBPasswordPrompter(Frame frame, String title, Database database)Constructs a
DBPasswordPrompter
with a specified Frame
, a text string that displays on the title bar, and the Database
to connect to.
frame
Frame
of the dialog box.
title
database
Database
to connect to.
public Database getDatabase() public void setDatabase(Database database)Returns and sets the
com.borland.dx.sql.dataset.Database
the user is trying to access. You must set the database
property before calling showDialog()
to display the dialog box.
public Frame getFrame() public void setFrame(Frame frame)Returns and sets the parent
Frame
for the dialog box. You must set the database
property before calling showDialog()
to display the dialog box.
public int getMaxAttempts() public void setMaxAttempts(int maxAttempts)Returns and sets the maximum number of attempts the user can try to enter a valid password before the dialog box closes. The default value is three.
public String getPassword() public void setPassword(String password)Returns and sets a default password.
public boolean isPasswordRequired() public void setPasswordRequired(boolean passwordRequired)Returns whether or not a password must be entered to close the dialog with the OK button. Sets whether or not a password must be entered to close the dialog with the OK button.
public String getTitle() public void setTitle(String title)Returns and sets a text string that appears on the title bar. Setting this property is optional. If you don't set it, the URL of the database displays on the title bar. To disable this automatic display, set
title
to an empty string ("").
public String getUserName() public void setUserName(String userName)Returns and sets a default username.
public boolean isUserNameRequired() public void setUserNameRequired(boolean userNameRequired)Returns and sets whether or not a user name must be entered to close the dialog with the OK button.
public void show()Calls the
showDialog()
method.
public boolean showDialog()Displays the password prompter dialog. Before calling this method, set both the
frame
and database
properties or an IllegalStateException
is thrown. showdialog()
connects with the database and returns true
if a valid password is entered within the number of attempts specified by maxAttempts
.
frame
, maxAttempts