//Member Login
	public static boolean memberLogin(){
		int memberPassword = 123;
		boolean password = false;
		
		int confirm = JOptionPane.showConfirmDialog(null, "Are You A Member? ", "Member Confirmation", JOptionPane.YES_NO_OPTION);
		
		do{
			while(confirm == JOptionPane.YES_OPTION && password == false){
				String tempCurrentPassword = JOptionPane.showInputDialog(null, "Please Enter Your Password", "Default Password = 123");
				int currentPassword = Integer.parseInt(tempCurrentPassword);
				
				if(currentPassword == memberPassword){
					JOptionPane.showMessageDialog(null, "You've Entered Correctly!", "Login Successful", JOptionPane.INFORMATION_MESSAGE);
					password = true;
				}
				else{
					JOptionPane.showMessageDialog(null, "You've Entered Wrongly!", "Login Failed", JOptionPane.ERROR_MESSAGE);
					password = false;
				}
			}
			
			if(confirm == JOptionPane.NO_OPTION)
				memberRegister(memberPassword);
				
		}while(password == false);
		
		return password;
	}
	
	//Member Registration
	public static void memberRegister(int memberPassword){
		String tempPass = JOptionPane.showInputDialog(null, "Enter Your Password", "Enter Your Password, Integer Type Only");
		memberPassword = Integer.parseInt(tempPass);
	}

is these two method, i am trying to ask the user whether he is member or not.
it is run correctly if user choose YES, but if user choose NO, it will keep run and run and run memberRegister() method. Where's my mistake?

Well, first of all, you must give us the entire class if we want to help you.
Second of all, you haven't mentioned how your app behaved when u ran it and what made you think its not working.

So please provide those info.

But Ill make some assumptions and will try to help you now.
The memberPassword variable is local to memberLogin()method. and hence when memberRegister() method gets a new password and sets its argument (memberPassword) with the new pass, the original memberPassword in memberLogin() doesnt change at all.

I recommend you make the password variable global to the class and use it. Or you can make the memberRegister method return the new password and set it to the variable inside memberLogin(). So that way when the user enters password second time, the check will be satisfied.

awh, i think where's my problem already..
because when it go to memberRegsiter() method, it is unstoppable to execute that method, is because i didn't put my "confirm" inside the do-while loop, that's why.
:):) by the way, thanks for helping. :)

OK. gr8.

But im confused.
As user comes in for the first time, says he is unregistered. So confirm=NO. Now u go to register method and the user gives in a new password. Now u return and why do u want to ask whether he is registered or not again? and also member password variable remains at 123 and not the value the user gave while registering.

Anyway, youre welcome.

haha, because i also did some modification.
memberPassword modifted like you said, as global in class with static(because static can change value directly):)

Thats gr8 then! Good luck..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.