我想开发一个简单的登录和注册系统。系统需要能够注册用户并允许他们登录。不仅如此,我还需要能够识别当前登录的用户是谁。
用户类
import java.io.Serializable;
public class AuctionHouseUsers implements Serializable {
String userName;
String password;
public AuctionHouseUsers(String aUserName, String aPassword)
{
this.userName = aUserName;
this.password = aPassword;
}
public String getUserName()
{
return userName;
}
public void setUserName(String aUserName)
{
this.userName = aUserName;
}
public String getPassword()
{
return password;
}
public void setPassword(String aPassword)
{
this.password = aPassword;
}
}
拍卖行类
public class AuctionHouseManager
ArrayList<AuctionHouseUsers> registeredUsers;
ArrayList<AuctionHouseUsers> logedInUsers;
public AuctionHouseManager()
logedInUsers = new ArrayList<AuctionHouseUsers>();
registeredUsers = new ArrayList<AuctionHouseUsers>();
}
public void registerUser(String username, string password)
{
AuctionHouseUsers registeredUser = new AuctionHouseUser(username,password);
registeredUsers.add(tempUser);
}
public void logIn(String username, string password)
{
AuctionHouseUsers logedInUser = new AuctionHouseUser(username,password);
logedInUsers.add(logedInUser);
}
我如何跟踪谁(通过那里的用户名)目前在这个时间登录,因为我将设计一个 gui。