java第二次作业
package 教务综合系统;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPasswordField;
public class applogin1 {
public static void main(String[] args) {
//创建界面
final JFrame frm = new JFrame("账户登录");
frm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frm.setLayout(null);
JLabel label1 = new JLabel("输入学号:");
label1.setBounds(50, 40, 120, 25);
JLabel label2 = new JLabel("密 码:");
label2.setBounds(50, 80, 120, 25);
frm.add(label1);
frm.add(label2);
//组合框
JComboBox text = new JComboBox();
text.setBounds(120, 40, 150, 25);
text.addItem("2014330101");
text.addItem("2014330102");
text.addItem("2014330103");
text.addItem("2014330104");
text.addItem("2014330105");
text.addItem("2014330106");
text.addItem("2014330107");
text.addItem("2014330108");
text.addItem("2014330109");
text.addItem("20143301010");
text.addItem("20143301011");
text.addItem("20143301012");
text.addItem("20143301013");
text.addItem("20143301014");
text.addItem("20143301015");
text.addItem("20143301016");
text.addItem("20143301017");
text.addItem("20143301018");
text.addItem("20143301019");
text.addItem("20143301020");
text.addItem("20143301021");
text.addItem("20143301022");
text.addItem("20143301023");
text.addItem("20143301024");
text.addItem("20143301025");
text.addItem("20143301026");
text.addItem("20143301027");
text.addItem("20143301028");
text.addItem("20143301029");
text.addItem("20143301030");
text.addItem("20143301031");
text.addItem("20143301032");
text.setEditable(true);
//组合框可编辑
JPasswordField password = new JPasswordField("");
password.setBounds(120, 80, 150, 25);
frm.add(text);
frm.add(password);
//创建按钮
JButton yes = new JButton("确定");
yes.setBounds(140, 120, 95,25);
frm.add(yes);
frm.pack();
frm.setBounds(600,300,400,240);
frm.setVisible(true);
}
}
在这周的学习中,对于组件的认识和了解还是表现出相当的匮乏,在以后的学习中会加强这方面,能力有限,老师理解,嘿嘿!