Results 1 to 6 of 6

Thread: Login

  1. #1
    geniusokorro is offline Member
    Join Date
    Jul 2011
    Posts
    2
    Rep Power
    0

    Lightbulb Login

    I am working on a project using netbeans to write a program for a database creation and MS Access as my DB. I designed the login form using Netbeans JFrame option I am able to call up the next window but I dont know how to write the part of the code that should make the login window go off at the same single click that prompts the Application Form window.
    The login form should be able to access a database where possible login ID and password have been saved.

    A full source code on a login form design and a button that calls up the next window and disposes of the login form would be highly appreciated.

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    Quote Originally Posted by geniusokorro View Post
    I am working on a project using netbeans to write a program for a database creation and MS Access as my DB. I designed the login form using Netbeans JFrame option I am able to call up the next window but I dont know how to write the part of the code that should make the login window go off at the same single click that prompts the Application Form window.
    I would make the Login window a JPanel that is placed in a JOptionPane.showConfirmDialog, one that is called from the main window that might be non-visible at the time Login is shown, and then made visible immediately after Login exits. The Java tutorials on JOptionPanes can show you how to use these guys, and we can help you if get stuck at any spot.

    The login form should be able to access a database where possible login ID and password have been saved.
    I wouldn't even do this. I'd just have Login display two fields to get the user's name and password, and then after the JOptionPane that holds Login has been dealt with (a button has been clicked) get the user's name and password from the fields held by Login and have the main application check to see if they are valid, and then decide where the program should go from there.

    A full source code on a login form design and a button that calls up the next window and disposes of the login form would be highly appreciated.
    This request is considered cheating on this forum and will not be tolerated. Please retract this. Please note that we don't care if this is an academic assignment or not since it matters not whether you are cheating your classmates or cheating yourself -- it remains cheating nonetheless.

  3. #3
    geniusokorro is offline Member
    Join Date
    Jul 2011
    Posts
    2
    Rep Power
    0

    Default

    it aint cheating in any way. I need help with the portion that disiposes the login window and calls up the next form. It is a
    class project and we are allowed to source for assistance where we find difficult. My request for the full source code is just so I can appreciate the progress of the program soucre code. Note, the project contains an application form, an update form and a report form which my group and I have successfully completed.
    Last edited by geniusokorro; 07-31-2011 at 10:16 PM.

  4. #4
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    Quote Originally Posted by geniusokorro View Post
    it aint cheating in any way. I need help with the portion that disiposes the login window and calls up the next form. It is a
    class project and we are allowed to source for assistance where we find difficult.
    Regardless if your teacher doesn't consider it bad, regardless if it's not even for school, a request for "the code" is not proper here and not looked kindly upon. We will be more than happy to help you work through your own code, and this should be sufficient, you think?

    We can debate this further if you want, or we can help answer any further programming questions you may have. Myself I prefer the latter.

    Regarding disposal of the login window, I've given you a suggestion in my first post.
    Last edited by Fubarable; 07-31-2011 at 10:21 PM.

  5. #5
    Join Date
    Aug 2011
    Posts
    3
    Rep Power
    0

    Default

    What have you done so far. Atleast tell us the event you have writhen and and how we could help u.

    most of the time u may have done an sql statement that will query the database for username and password
    Java Code:
    String  query = "Select *Frome userTable where user ="user" && "pass="password"";

    sometimes
    Java Code:
    btn.addactionListener(this)
    Java Code:
    public void action actionPerformed(ActionEvent e){
      String user == jTextField.getText();
      String pass == jTextField.getText();
    
      if(user == "" && pass==""){
      //do sometines
      }
    }
    Last edited by sunde887; 08-07-2011 at 02:46 PM. Reason: Added code tags, [code]...[/code]

  6. #6
    sunde887's Avatar
    sunde887 is offline Moderator
    Join Date
    Jan 2011
    Location
    Richmond, Virginia
    Posts
    3,069
    Blog Entries
    3
    Rep Power
    8

    Default

    There are some flaws in your snippet Ewain.
    Java Code:
    String user == jTextField.getText();
    Doesn't do assignment like you expect, you added an extra '=' and it should be
    Java Code:
    String user = jTextField.getText();
    String pass = jTextField.getText();

Similar Threads

  1. help with login
    By dhazwa in forum New To Java
    Replies: 2
    Last Post: 07-23-2011, 09:05 PM
  2. JAVA SSL login
    By wany in forum Java Servlet
    Replies: 0
    Last Post: 04-28-2011, 03:05 AM
  3. login.jsp
    By roo7 in forum Enterprise JavaBeans (EJB)
    Replies: 5
    Last Post: 12-02-2008, 04:58 PM
  4. Login page
    By banie in forum JavaServer Pages (JSP) and JSTL
    Replies: 2
    Last Post: 07-03-2008, 03:05 PM
  5. Replies: 0
    Last Post: 06-25-2008, 01:41 PM

Posting Permissions

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