歡迎來到裝配圖網(wǎng)! | 幫助中心 裝配圖網(wǎng)zhuangpeitu.com!
裝配圖網(wǎng)
ImageVerifierCode 換一換
首頁 裝配圖網(wǎng) > 資源分類 > DOC文檔下載  

Java注冊界面設(shè)計(jì).doc

  • 資源ID:5415401       資源大?。?span id="xt5bqqw" class="font-tahoma">40.50KB        全文頁數(shù):5頁
  • 資源格式: DOC        下載積分:15積分
快捷下載 游客一鍵下載
會員登錄下載
微信登錄下載
三方登錄下載: 微信開放平臺登錄 支付寶登錄   QQ登錄   微博登錄  
二維碼
微信掃一掃登錄
下載資源需要15積分
郵箱/手機(jī):
溫馨提示:
用戶名和密碼都是您填寫的郵箱或者手機(jī)號,方便查詢和重復(fù)下載(系統(tǒng)自動生成)
支付方式: 支付寶    微信支付   
驗(yàn)證碼:   換一換

 
賬號:
密碼:
驗(yàn)證碼:   換一換
  忘記密碼?
    
友情提示
2、PDF文件下載后,可能會被瀏覽器默認(rèn)打開,此種情況可以點(diǎn)擊瀏覽器菜單,保存網(wǎng)頁到桌面,就可以正常下載了。
3、本站不支持迅雷下載,請使用電腦自帶的IE瀏覽器,或者360瀏覽器、谷歌瀏覽器下載即可。
4、本站資源下載后的文檔和圖紙-無水印,預(yù)覽文檔經(jīng)過壓縮,下載后原文更清晰。
5、試題試卷類文檔,如果標(biāo)題沒有明確說明有答案則都視為沒有答案,請知曉。

Java注冊界面設(shè)計(jì).doc

.Java注冊界面設(shè)計(jì)package test;import java.awt.Component;import java.awt.Dimension;import java.awt.Font;import java.awt.GridBagConstraints;import java.awt.GridBagLayout;import java.awt.Toolkit;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import javax.swing.BorderFactory;import javax.swing.Box;import javax.swing.ButtonGroup;import javax.swing.JButton;import javax.swing.JComboBox;import javax.swing.JFrame;import javax.swing.JLabel;import javax.swing.JOptionPane;import javax.swing.JPanel;import javax.swing.JPasswordField;import javax.swing.JRadioButton;import javax.swing.JTextField;import javax.swing.border.Border;import java.util.Vector;public class Register_GUI public Register_GUI() RegisterFrame rf = new RegisterFrame();rf.setVisible(true);public static void main(String args) new Register_GUI();class RegisterFrame extends JFrame / 框架類/* * */private static final long serialVersionUID = -3779096743730354383L;private Toolkit tool;public RegisterFrame() setTitle("用戶注冊");tool = Toolkit.getDefaultToolkit();Dimension ds = tool.getScreenSize();int w = ds.width;int h = ds.height;setBounds(w - 300) / 2, (h - 300) / 2, 300, 300);setResizable(false);RegisterPanel rp = new RegisterPanel(this);add(rp);class RegisterPanel extends JPanel implements ActionListener / 容器類/* * */private static final long serialVersionUID = -7078727217525013349L;private JLabel titlelabel, namelabel, pwdlabel1, pwdlabel2, sexlabel,agelabel, classlabel;private JTextField namefield, agefield;private JPasswordField pwdfield1, pwdfield2;private JButton commitbtn, resetbtn, cancelbtn;private JRadioButton rbtn1, rbtn2;private JComboBox combo;private Vector<String> v;private GridBagLayout gbl;private GridBagConstraints gbc;private JPanel panel;private Box box;private JFrame iframe;RegisterPanel(JFrame frame) iframe = frame;titlelabel = new JLabel("用戶注冊");titlelabel.setFont(new Font("華文彩云", Font.BOLD, 24);namelabel = new JLabel("用 戶 名:");pwdlabel1 = new JLabel("密 碼:");pwdlabel2 = new JLabel("確認(rèn)密碼:");sexlabel = new JLabel("性 別:");agelabel = new JLabel("年 齡:");classlabel = new JLabel("所屬班級:");namefield = new JTextField(16);pwdfield1 = new JPasswordField(16);pwdfield1.setEchoChar(*);pwdfield2 = new JPasswordField(16);pwdfield2.setEchoChar(*);agefield = new JTextField(16);rbtn1 = new JRadioButton("男");rbtn2 = new JRadioButton("女");rbtn1.setSelected(true);ButtonGroup bg = new ButtonGroup();bg.add(rbtn1);bg.add(rbtn2);v = new Vector<String>();v.add("ACCP1");v.add("ACCP2");v.add("軟件開發(fā)");v.add("網(wǎng)絡(luò)編程");v.add("計(jì)算機(jī)應(yīng)用");combo = new JComboBox(v);commitbtn = new JButton("注冊");commitbtn.addActionListener(this);resetbtn = new JButton("重置");resetbtn.addActionListener(this);cancelbtn = new JButton("取消");cancelbtn.addActionListener(this);panel = new JPanel();panel.add(rbtn1);panel.add(rbtn2);Border border = BorderFactory.createTitledBorder("");panel.setBorder(border);box = Box.createHorizontalBox();box.add(commitbtn);box.add(Box.createHorizontalStrut(30);box.add(resetbtn);box.add(Box.createHorizontalStrut(30);box.add(cancelbtn);gbl = new GridBagLayout();setLayout(gbl);gbc = new GridBagConstraints();addCompnent(titlelabel, 0, 0, 4, 1);add(Box.createVerticalStrut(20);gbc.anchor = GridBagConstraints.CENTER;gbc.fill = GridBagConstraints.HORIZONTAL;gbc.weightx = 0;gbc.weighty = 100;addCompnent(namelabel, 0, 1, 1, 1);addCompnent(namefield, 1, 1, 4, 1);addCompnent(pwdlabel1, 0, 2, 1, 1);addCompnent(pwdfield1, 1, 2, 4, 1);addCompnent(pwdlabel2, 0, 3, 1, 1);addCompnent(pwdfield2, 1, 3, 4, 1);addCompnent(sexlabel, 0, 4, 1, 1);addCompnent(panel, 1, 4, 1, 1);gbc.anchor = GridBagConstraints.EAST;gbc.fill = GridBagConstraints.NONE;addCompnent(agelabel, 2, 4, 1, 1);gbc.fill = GridBagConstraints.HORIZONTAL;addCompnent(agefield, 3, 4, 2, 1);addCompnent(classlabel, 0, 5, 4, 1);addCompnent(combo, 1, 5, 4, 1);gbc.anchor = GridBagConstraints.CENTER;gbc.fill = GridBagConstraints.NONE;addCompnent(box, 0, 6, 4, 1);public void addCompnent(Component c, int x, int y, int w, int h) gbc.gridx = x;gbc.gridy = y;gbc.gridwidth = w;gbc.gridheight = h;add(c, gbc);public void actionPerformed(ActionEvent e) Register rinfo = new Register();if (e.getSource() = commitbtn) rinfo.name = namefield.getText().trim();rinfo.password = new String(pwdfield1.getPassword();rinfo.sex = rbtn1.isSelected() ? "男" : "女"rinfo.age = agefield.getText().trim();rinfo.nclass = combo.getSelectedItem().toString();if (rinfo.name.length() = 0) JOptionPane.showMessageDialog(null, "t 用戶名不能為空");return;if (rinfo.password.length() = 0) JOptionPane.showMessageDialog(null, "t 密碼不能為空 ");return;if (!rinfo.password.equals(new String(pwdfield2.getPassword() JOptionPane.showMessageDialog(null, "密碼兩次輸入不一致,請重新輸入");return;if (rinfo.age.length() = 0) JOptionPane.showMessageDialog(null, "t 年齡不能為空");return;int age = Integer.parseInt(rinfo.age);if (age <= 0 | age > 100) JOptionPane.showMessageDialog(null, "t 年齡輸入不合法");return;JOptionPane.showMessageDialog(null, "t 注冊成功!" +" n 姓名:"+rinfo.name+" n 性別:"+rinfo.sex+"n 年齡:"+rinfo.age+"n 班級: "+rinfo.nclass);if (e.getSource() = resetbtn) namefield.setText("");pwdfield1.setText("");pwdfield2.setText("");rbtn1.isSelected();agefield.setText("");combo.setSelectedIndex(0);if (e.getSource() = cancelbtn) iframe.dispose();class Register String name;String password;String sex;String age;String nclass;精選word范本!

注意事項(xiàng)

本文(Java注冊界面設(shè)計(jì).doc)為本站會員(鐘***)主動上傳,裝配圖網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對上載內(nèi)容本身不做任何修改或編輯。 若此文所含內(nèi)容侵犯了您的版權(quán)或隱私,請立即通知裝配圖網(wǎng)(點(diǎn)擊聯(lián)系客服),我們立即給予刪除!

溫馨提示:如果因?yàn)榫W(wǎng)速或其他原因下載失敗請重新下載,重復(fù)下載不扣分。




關(guān)于我們 - 網(wǎng)站聲明 - 網(wǎng)站地圖 - 資源地圖 - 友情鏈接 - 網(wǎng)站客服 - 聯(lián)系我們

copyright@ 2023-2025  zhuangpeitu.com 裝配圖網(wǎng)版權(quán)所有   聯(lián)系電話:18123376007

備案號:ICP2024067431-1 川公網(wǎng)安備51140202000466號


本站為文檔C2C交易模式,即用戶上傳的文檔直接被用戶下載,本站只是中間服務(wù)平臺,本站所有文檔下載所得的收益歸上傳人(含作者)所有。裝配圖網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對上載內(nèi)容本身不做任何修改或編輯。若文檔所含內(nèi)容侵犯了您的版權(quán)或隱私,請立即通知裝配圖網(wǎng),我們立即給予刪除!