4 Replies - 193 Views - Last Post: 31 January 2013 - 07:19 PM Rate Topic: -----

#1 bloodfall90  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 29-January 13

Create an Account Program Project

Posted 29 January 2013 - 03:47 PM

I know I'm not supposed to ask for code and that's not what I intend to do. I haven't actually gotten anywhere with this, but I really want to! Can anyone give me parsels of code/tips for doing this? I have a program that opens a JFrame and asks for an account user and password. But how can I connect this and actually make an option for creating an account?
Here is the code for logging in to the account.


import javax.swing.JOptionPane;

public class FrameTest {
	
	public static void main(String args[]) {
	
	String username =
		JOptionPane.showInputDialog("Username:");
	String password =
		JOptionPane.showInputDialog("Password:"); {
	
	if (
		username != null &&
		password != null &&
		(
				(username.equals("bloodfall90") &&
				password.equals("hi"))
		
		)
		)
	{
		JOptionPane.showMessageDialog
			(null, "Correct.");
	} else {
		JOptionPane.showMessageDialog
			(null, "Incorrect.");
	} 
		}
}

}

Is This A Good Question/Topic? 0
  • +

Replies To: Create an Account Program Project

#2 g00se  Icon User is online

  • D.I.C Lover
  • member icon

Reputation: 2557
  • View blog
  • Posts: 10,673
  • Joined: 20-September 08

Re: Create an Account Program Project

Posted 29 January 2013 - 04:12 PM

http://technojeeves....with-cardlayout
Was This Post Helpful? 0
  • +
  • -

#3 macosxnerd101  Icon User is offline

  • Self-Trained Economist
  • member icon




Reputation: 10188
  • View blog
  • Posts: 37,629
  • Joined: 27-December 08

Re: Create an Account Program Project

Posted 29 January 2013 - 05:48 PM

First, please work on your indentation conventions.

As for account creation, there are a few ways you can do that. First, you will need a place to store the usernames and passwords so they are persistent after your program terminates. For a basic program, a File will do. As you progress, a database is really the way to go.

How familiar are you with OOP? You will want to design a User class to encapsulate the user information, like username and password.

Start working on the basic design of your program too.
Was This Post Helpful? 0
  • +
  • -

#4 bloodfall90  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 29-January 13

Re: Create an Account Program Project

Posted 31 January 2013 - 06:22 PM

View Postmacosxnerd101, on 29 January 2013 - 05:48 PM, said:

First, please work on your indentation conventions.

As for account creation, there are a few ways you can do that. First, you will need a place to store the usernames and passwords so they are persistent after your program terminates. For a basic program, a File will do. As you progress, a database is really the way to go.

How familiar are you with OOP? You will want to design a User class to encapsulate the user information, like username and password.

Start working on the basic design of your program too.


How would I set up things for the seperate file. Also if you mean object oriented programming then how would I put that to use?
Was This Post Helpful? 0
  • +
  • -

#5 macosxnerd101  Icon User is offline

  • Self-Trained Economist
  • member icon




Reputation: 10188
  • View blog
  • Posts: 37,629
  • Joined: 27-December 08

Re: Create an Account Program Project

Posted 31 January 2013 - 07:19 PM

There is the basics of File I/O. You could also look into using a Properties file.

We also have a ton of OOP tutorials listed here.

As a note, if you aren't familiar and really comfortable with OOP, don't go trying to delve into Swing much beyond JOptionPane at the moment. Swing is very bulky and it's easy to get overwhelmed.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1