-
大小: 18KB文件類型: .zip金幣: 2下載: 0 次發(fā)布日期: 2023-12-29
- 語(yǔ)言: 其他
- 標(biāo)簽: java??簡(jiǎn)單界面??登錄??注冊(cè)??
資源簡(jiǎn)介
使用Swing組件庫(kù),完成用戶登錄和注冊(cè)對(duì)話框的設(shè)計(jì),當(dāng)用戶單擊“注冊(cè)”按鈕時(shí),彈出一個(gè)對(duì)話框,完成用戶的注冊(cè),要求如下:
1)用戶名輸入框:TextField 2)密碼輸入框:TextField
3)重輸入密碼框:TextField 4)用戶接受條款:TextArea
5)性別:Choice 6)郵箱輸入框和是否公開(kāi)郵箱:TextField和CheckBox
7)愛(ài)好:CheckBox(數(shù)量不限) 8)獲得用戶輸入的結(jié)果之后進(jìn)行匯總顯示。
同時(shí)要求在用戶登錄時(shí)需要輸入驗(yàn)證碼,其原理為:使用Random產(chǎn)生兩個(gè)隨機(jī)數(shù),對(duì)其進(jìn)行加法運(yùn)算,如果用戶輸入的數(shù)據(jù)正確則可以登錄,否則無(wú)法登錄

代碼片段和文件信息
package?yonghuzhuce;
import?java.awt.Color;
import?java.awt.Toolkit;
import?java.awt.event.ActionEvent;
import?java.awt.event.ActionListener;
import?javax.swing.JButton;
import?javax.swing.JCheckBox;
import?javax.swing.JComboBox;
import?javax.swing.Jframe;
import?javax.swing.JLabel;
import?javax.swing.JOptionPane;
import?javax.swing.JPasswordField;
import?javax.swing.JRadioButton;
import?javax.swing.JTextArea;
import?javax.swing.JTextField;
@SuppressWarnings({?“serial“?“unused“?})
public?class?IJframe?extends?Jframe{
private?JLabel[]?jLabels1={new?JLabel(“用戶名“)new?JLabel(“密?碼:“)new?JLabel(“確認(rèn)密碼:“)
new?JLabel(“性別:“)new?JLabel(“郵箱:“)new?JLabel(“興?趣:“)new?JLabel(“@“)};
//?reginfo?=?new?JLabel(“?“);
private?JTextField?jnameField=new?JTextField();
private?JPasswordField?jPasswordField=new?JPasswordField();
private?JPasswordField?jPasswordField1=new?JPasswordField();
private?JTextField?jTextField=new?JTextField();
?String[]?nians?=?{?“163.com“?“qq.com“?“126.com“?“gmail.com“?“139.com“};
?????@SuppressWarnings({?“rawtypes“?“unchecked“?})
private final?JComboBox?jcomboBox?=?new?JComboBox(nians);
?????
private?JButton[]?jButtons1=?{new?JButton(“注冊(cè)“)new?JButton(“重置“)new?JButton(“取消“)};
private?final?JRadioButton[]?jRadioButton=?{new?JRadioButton(“男“)
new?JRadioButton(“女“)};
private?final?JCheckBox[]?jCheckBoxs=?{new?JCheckBox(“公開(kāi)“)new?JCheckBox(“唱“)
new?JCheckBox(“rap“)new?JCheckBox(“跳“)new?JCheckBox(“籃球“)};
private?final?JTextArea?jTextArea=new?JTextArea(“受中華人民共和國(guó)法律保護(hù)!“);
public?IJframe()?{
this.setLayout(null);
jLabels1[0].setBounds(20?10?50?25);
jnameField.setBounds(70?10?170?25);
jLabels1[1].setBounds(20?60?50?25);
jPasswordField.setBounds(70?60?170?25);
jLabels1[2].setBounds(20?110?50?25);
jPasswordField1.setBounds(70?110?170?25);
jLabels1[3].setBounds(20?160?50?25);
jRadioButton[0].setBounds(80?1604040);
jRadioButton[1].setBounds(160?160?40?40);
jLabels1[4].setBounds(20?210?50?25);
jTextField.setBounds(70210?85?25);
jLabels1[6].setBounds(160?210?25?25);
jcomboBox.setBounds(185?210?100?25);
jCheckBoxs[0].setBounds(30?240?100?50);
jLabels1[5].setBounds(20?290?50?25);
jCheckBoxs[1].setBounds(30?330?40?20);
jCheckBoxs[2].setBounds(80?330?50?20);
jCheckBoxs[3].setBounds(130?330?40?20);
jCheckBoxs[4].setBounds(180?330?80?20);
jTextArea.setBounds(10?360?260?20);
jButtons1[0].setBounds(40?400?60?30);
jButtons1[1].setBounds(120?400?60?30);
jButtons1[2].setBounds(200?400?60?30);
this.add(jLabels1[0]);?????this.add(jnameField);
this.add(jLabels1[1]);?????this.add(jPasswordField);
this.add(jLabels1[2]);?????this.add(jPasswordField1);
this.add(jLabels1[3]);
this.add(jRadioButton[0]);??this.add(jRadioButton[1]);
this.add(jLabels1[4]);?????this.add(jTextField);??this.add(jLabels1[6])
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2019-05-13?14:55??ShiYan4-1\
?????文件?????????301??2019-05-13?14:55??ShiYan4-1\.classpath
?????文件?????????385??2019-05-13?14:55??ShiYan4-1\.project
?????目錄???????????0??2019-05-13?14:55??ShiYan4-1\.settings\
?????文件?????????598??2019-05-13?14:55??ShiYan4-1\.settings\org.eclipse.jdt.core.prefs
?????目錄???????????0??2019-05-20?10:04??ShiYan4-1\bin\
?????目錄???????????0??2019-05-24?15:26??ShiYan4-1\bin\yonghuzhuce\
?????文件????????3125??2019-05-27?14:05??ShiYan4-1\bin\yonghuzhuce\IJfr
?????文件????????1356??2019-05-27?14:05??ShiYan4-1\bin\yonghuzhuce\IJfr
?????文件?????????674??2019-05-27?14:05??ShiYan4-1\bin\yonghuzhuce\IJfr
?????文件????????4240??2019-05-27?14:05??ShiYan4-1\bin\yonghuzhuce\IJfr
?????文件?????????675??2019-05-24?15:26??ShiYan4-1\bin\yonghuzhuce\MyJFame$1.class
?????文件?????????941??2019-05-24?15:26??ShiYan4-1\bin\yonghuzhuce\MyJFame$2.class
?????文件????????1239??2019-05-24?15:26??ShiYan4-1\bin\yonghuzhuce\MyJFame$3.class
?????文件????????3068??2019-05-24?15:26??ShiYan4-1\bin\yonghuzhuce\MyJFame.class
?????文件????????1028??2019-05-27?14:03??ShiYan4-1\bin\yonghuzhuce\WJfr
?????文件?????????674??2019-05-27?14:03??ShiYan4-1\bin\yonghuzhuce\WJfr
?????文件????????1210??2019-05-27?14:03??ShiYan4-1\bin\yonghuzhuce\WJfr
?????目錄???????????0??2019-05-13?14:56??ShiYan4-1\src\
?????目錄???????????0??2019-05-24?11:17??ShiYan4-1\src\yonghuzhuce\
?????文件????????7466??2019-05-27?14:05??ShiYan4-1\src\yonghuzhuce\IJfr
?????文件????????3348??2019-05-24?15:26??ShiYan4-1\src\yonghuzhuce\MyJFame.java
?????文件????????1500??2019-05-27?14:03??ShiYan4-1\src\yonghuzhuce\WJfr
評(píng)論
共有 條評(píng)論