Table of contents
Topic requirements:
Use Set interface to implement the use of class HashSet, create a collection to store registered users, as shown in the following figure:
Merge, traverse the registered user information collection to implement the login function, as shown below:
The general idea:
It means that after inputting content into form A and storing it in list X, inputting content into form B again, form B is used to judge whether the content input into form B exists in list X.
Therefore, form A needs to realize the function of jumping to form B and the function of storing to list X, while form B needs to realize the function of whether the input content has already existed in list X.
Implementation of form:
Use JFram in the windowBuilder plug-in of the eclipse software to draw the form
Window A:
lblNewLabel_3 is a hidden window used to prompt the user whether the registration is successful and the reason for the failure.
Window B:
lblNewLabel_2 is a hidden window used to prompt the user whether the registration is successful and the reason for the failure.
Ideas between forms:
This question requires the use of two forms, so there needs to be a list in the middle to store the form content, and we need to set a button in one form, which needs to realize the process of jumping from form A to form B.
Window B needs to obtain the information stored in the list to determine whether the traversal and display are successful.
Implementation of key code:
Window A:
Package list:
Window B: