Results 1 to 3 of 3
  1. #1
    Eric is offline Senior Member
    Join Date
    Jun 2007
    Posts
    111
    Rep Power
    0

    Default JTextFields with username & password.

    What is the best way of implementing with JTextFields a username system.
    For example to get onto a database you need a username & password, if my GUI prompts for these, what do I need to do to parse this information into my code.
    For example in my file I have:

    Java Code:
    static final String USERNAME = "root";
    Java Code:
    tableModel = new ResultSetTableModel1( JDBC_DRIVER, DATABASE_URL, USERNAME, PASSWORD, DEFAULT_QUERY );
    Java Code:
    public ResultSetTableModel1( String driver, String url,
     String username, String password, String query )
     throws SQLException, ClassNotFoundException
     {
     // load database driver class
     Class.forName( driver );
     
     // connect to database
     connection = DriverManager.getConnection( url, username, password );
    Thanks.
    Eric

  2. #2
    Daniel is offline Member
    Join Date
    Jun 2007
    Posts
    91
    Rep Power
    0

    Default

    You may want to use a JPasswordField for your passwords if you are concerned about security of the typed in password. Basically this is a JTextField that echos a * for each character typed.

    Greetings.

    Daniel:o

  3. #3
    Eric is offline Senior Member
    Join Date
    Jun 2007
    Posts
    111
    Rep Power
    0

    Default

    Well basically, I have a splash screen that comes up, depending on what is chosen on that screen depends on which program runs.

    Kind of like "if option 1" run Program 1

    "if option 2" run Program 2

    The thing is, on this splash screen I want a field that can be typed into, and whatever goes into it, when a submit button is pressed on the splash screen, it passes this information into either program 1 or program 2.

    Greetings.

    Eric

Similar Threads

  1. Password System help
    By quickfingers in forum New To Java
    Replies: 1
    Last Post: 06-23-2008, 06:18 PM
  2. Asking for password from a Servlet
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 01-27-2008, 08:05 PM
  3. How to prevent duplicate username entry in database?
    By anki1234 in forum JavaServer Pages (JSP) and JSTL
    Replies: 4
    Last Post: 01-09-2008, 08:02 AM
  4. Problem with JTextFields not null
    By romina in forum AWT / Swing
    Replies: 1
    Last Post: 08-07-2007, 05:17 AM
  5. Help, created a username and password box
    By cachi in forum AWT / Swing
    Replies: 1
    Last Post: 08-07-2007, 04:21 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •