borland Packages  Class Hierarchy  dbswing Package 

DBPasswordPrompter component

java.lang.Object
   +----com.borland.dbswing.DBPasswordPrompter

About the DBPasswordPrompter component

Constructors  Properties  Methods  

Implements ActionListener, Serializable, EventListener

Note: This is a feature of JBuilder Professional and Enterprise.

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.


DBPasswordPrompter constructors

DBPasswordPrompter properties

*Read-only properties **Write-only properties

Properties implemented in this class

Properties implemented in java.lang.Object

DBPasswordPrompter methods

Methods implemented in this class

Methods implemented in java.lang.Object


DBPasswordPrompter constructors

DBPasswordPrompter()

  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.

DBPasswordPrompter(java.awt.Frame, java.lang.String, com.borland.dx.sql.dataset.Database)

  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.

Parameters:

frame
The parent Frame of the dialog box.
title
The text string that appears on the title bar.
database
The Database to connect to.

DBPasswordPrompter properties

database

 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.

frame

 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.

maxAttempts

 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.

password

 public String getPassword()
 public void setPassword(String password)
Returns and sets a default password.

passwordRequired

 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.

title

 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 ("").

userName

 public String getUserName()
 public void setUserName(String userName)
Returns and sets a default username.

userNameRequired

 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.

DBPasswordPrompter methods

show()

  public void show()
Calls the showDialog() method.

showDialog()

  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.

See also: frame, maxAttempts