<output id="qn6qe"></output>

    1. <output id="qn6qe"><tt id="qn6qe"></tt></output>
    2. <strike id="qn6qe"></strike>

      亚洲 日本 欧洲 欧美 视频,日韩中文字幕有码av,一本一道av中文字幕无码,国产线播放免费人成视频播放,人妻少妇偷人无码视频,日夜啪啪一区二区三区,国产尤物精品自在拍视频首页,久热这里只有精品12

      晨時(shí)婧蜜

      導(dǎo)航

      JAVA第二次作業(yè)展示與學(xué)習(xí)心得

      JAVA第二次作業(yè)展示與學(xué)習(xí)心得 在這一次作業(yè)中,我學(xué)習(xí)了復(fù)選框,密碼框兩種新的組件,并通過(guò)一個(gè)郵箱登錄界面將兩種組件運(yùn)用了起來(lái)。具體的使用方法和其他得組件并沒(méi)有什么大的不同。 另外我通過(guò)查閱資料使用了一種新的布局方式------網(wǎng)格包布局.網(wǎng)格包布局管理是最復(fù)雜和靈活的布局管理,與網(wǎng)格布局管理器不同的是,網(wǎng)格包布局管理器允許容器中各個(gè)組件的大小各不相同,還允許組件跨越多個(gè)網(wǎng)格,也允許組件之間相互部分重疊。網(wǎng)格包布局理解為網(wǎng)格單元布局更合理,因?yàn)橐粋€(gè)容器被劃分為若干個(gè)網(wǎng)格單元,而每個(gè)組件放置在一個(gè)或多個(gè)網(wǎng)格單元中。要注意的是,網(wǎng)格包布局不能指定一個(gè)容器的網(wǎng)格單元的大小其網(wǎng)格單元的劃分是通過(guò)weightx和weighty參數(shù)來(lái)設(shè)置的,但也不是直接指定其網(wǎng)格單元的大小。當(dāng)把一個(gè)組件放置在網(wǎng)格單元中時(shí),組件所占據(jù)的位置和大小是由一組與他們相關(guān)聯(lián)的約束來(lái)決定的。這些約束是由GridBagConstraints類型的對(duì)象來(lái)設(shè)置的。 程序源代碼: import java.awt.; import javax.swing.; import java.awt.Color; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; public class emailx extends JFrame { private Checkbox rem_pwd; private Checkbox not_show; private Container c; private ActionEvent e; private ActionListener myActionLis; private JButton loginBut; private JButton exitBut; private JButton register; private JLabel label;// 標(biāo)簽 private JLabel label2; private JLabel no_use; private JPanel rem_not_show; private JPanel log_cancel; private JPasswordField password;// 密碼框 private JTextField usernametext;// 文本框 // 按鈕 public emailx() { rem_not_show = new JPanel();//用于裝記住密碼與隱身的兩個(gè)對(duì)象 log_cancel = new JPanel();//用于裝登陸和取消的兩個(gè)對(duì)象 rem_pwd = new Checkbox("記住密碼"); not_show = new Checkbox("隱身登陸"); /網(wǎng)格包布局是這種,可以達(dá)到效果/ GridBagLayout gblayout = new GridBagLayout(); GridBagConstraints constraints = new GridBagConstraints(); setTitle("郵箱登陸界面"); // 窗口的主容器 final Container c = getContentPane(); c.setLayout(gblayout); // 讓容器采用空布局 c.setBackground(Color.BLUE); constraints.weightx = 0; constraints.weighty = 0; constraints.gridx = 1; label = new JLabel("賬號(hào):",JLabel.CENTER); gblayout.setConstraints(label, constraints); c.add(label); constraints.gridx = 2; usernametext = new JTextField(10); gblayout.setConstraints(usernametext, constraints); c.add(usernametext); constraints.gridx = 3; register = new JButton("注冊(cè)"); gblayout.setConstraints(register, constraints); c.add(register); constraints.gridx = 1; constraints.gridy = 2; label2 = new JLabel("密碼:",JLabel.CENTER); gblayout.setConstraints(label2, constraints); c.add(label2); constraints.gridx = 2; password = new JPasswordField(10); gblayout.setConstraints(password, constraints); c.add(password); constraints.gridx = 2; constraints.gridy = 3; rem_not_show.add(rem_pwd); rem_not_show.add(not_show); rem_not_show.setBackground(c.getBackground()); gblayout.setConstraints(rem_not_show, constraints); c.add(rem_not_show); exitBut = new JButton(); exitBut.setText("刪除");// 設(shè)置按鈕值 loginBut = new JButton("進(jìn)入"); // 實(shí)例化組件 log_cancel.add(loginBut); log_cancel.add(exitBut); constraints.gridx = 2; constraints.gridy = 4; gblayout.setConstraints(log_cancel, constraints); log_cancel.setBackground(c.getBackground()); c.add(log_cancel); loginBut.setToolTipText("進(jìn)入請(qǐng)點(diǎn)擊該按鈕!"); // 給按鈕注冊(cè)監(jiān)聽(tīng)器 final myActionLis lis = new myActionLis(); loginBut.addActionListener(lis); setSize(400, 300); setVisible(true); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } public static void main(final String[] args) { new emailx(); } class myActionLis implements ActionListener { public void actionPerformed(final ActionEvent e) { // 獲取文本框或者密碼框的值(內(nèi)容) final String name = usernametext.getText(); final String pwd = password.getText(); if (name.equals("") || pwd.equals("")) { // 彈出提示框 JOptionPane.showMessageDialog(null, "賬號(hào)或者密碼不能為空!"); } else { if (name.equals("123456789@qq.com") && pwd.equals("123456789")) { JOptionPane.showMessageDialog(null, "恭喜您!登錄成功!"); } else { JOptionPane.showMessageDialog(null, "賬號(hào)或者密碼錯(cuò)誤!請(qǐng)重新輸入!"); } } } }} 程序運(yùn)行效果:

      posted on 2016-04-06 11:00  晨時(shí)婧蜜  閱讀(200)  評(píng)論(0)    收藏  舉報(bào)

      主站蜘蛛池模板: 久久一区二区中文字幕| 国产乱码精品一区二区三区四川人| 久久91精品牛牛| 国产极品美女高潮无套| 午夜免费视频国产在线| 国产成AV人片在线观看天堂无码| 国产一二三五区不在卡| 国产精品天天看天天狠| 夜夜爱夜鲁夜鲁很鲁| 老司机午夜免费精品视频| 国产日韩乱码精品一区二区| 澳门永久av免费网站| 亚洲国产欧美不卡在线观看 | 丰满的人妻hd高清日本| 97欧美精品系列一区二区| 一区二区三区人妻无码| 亚洲a片无码一区二区蜜桃| 亚洲人妻一区二区精品| 浑源县| 99国产精品欧美一区二区三区| 国产精品国三级国产av| 久久丫精品久久丫| 亚洲精品一区二区二三区| 久久综合久中文字幕青草| 国内熟妇人妻色在线视频| 免费看黄色片| xxxxbbbb欧美残疾人| 一级片黄色一区二区三区| 国产成人免费午夜在线观看| 国产精品一码二码三码| 国产欧美精品一区二区三区-老狼| 免费人成年激情视频在线观看| 日本东京热一区二区三区| 九色综合狠狠综合久久| 男人的天堂av社区在线| 91中文字幕一区二区| 99久久久无码国产精品免费| 国产精品视频一区二区不卡 | 国产av国片精品一区二区| 欧美日韩中文国产一区| 欧美色欧美亚洲高清在线视频|