📄 inputbasicinfo.java~1~
字号:
this.getContentPane().add(jButton_OK);
this.getContentPane().add(jButton_Reset);
this.getContentPane().add(jButton_GoOn);
this.getContentPane().add(jLabel_Info);
this.getContentPane().add(jLabel_Picture);
this.getContentPane().add(jButton_PhotoInput);
this.getContentPane().add(jLabel_PhotoStatus);
this.getContentPane().add(jLabel_Name);
this.getContentPane().add(jLabel_Grade);
this.getContentPane().add(jLabel_Status);
this.getContentPane().add(jLabel_Class);
this.getContentPane().add(jLabel_Other);
this.getContentPane().add(jButton_Cancel);
}
JLabel jLabel_SN = new JLabel();
JLabel jLabel_Name = new JLabel();
JTextField jTextField_SN = new JTextField();
JTextField jTextField_Name = new JTextField();
JLabel jLabel_Sex = new JLabel();
JLabel jLabel_Age = new JLabel();
JLabel jLabel_Nation = new JLabel();
JTextField jTextField_Age = new JTextField();
JComboBox jComboBox_Sex = new JComboBox();
JTextField jTextField_Nation = new JTextField();
JLabel jLabel_ID = new JLabel();
JTextField jTextField_ID = new JTextField();
JLabel jLabel_Major = new JLabel();
JLabel jLabel_College = new JLabel();
JTextField jTextField_Major = new JTextField();
JTextField jTextField_College = new JTextField();
JLabel jLabel_Other = new JLabel();
JLabel jLabel_Picture = new JLabel();
JButton jButton_OK = new JButton();
JButton jButton_GoOn = new JButton();
JButton jButton_Cancel = new JButton();
JButton jButton_Reset = new JButton();
JLabel jLabel_Prompt = new JLabel();
JTextField jTextField_Other = new JTextField();
JLabel jLabel_Grade = new JLabel();
JLabel jLabel_Class = new JLabel();
JLabel jLabel_Status = new JLabel();
JTextField jTextField_Class = new JTextField();
JTextField jTextField_Grade = new JTextField();
JComboBox jComboBox_Status = new JComboBox();
JLabel jLabel_Info = new JLabel();
JLabel jLabel_PhotoStatus = new JLabel();
JButton jButton_PhotoInput = new JButton();
public void reset() {
jTextField_Name.setText("");
jTextField_SN.setText("");
jTextField_ID.setText("");
jTextField_Age.setText("");
jTextField_Nation.setText("");
jTextField_Major.setText("");
jTextField_College.setText("");
jTextField_Class.setText("");
jTextField_Grade.setText("");
jTextField_Other.setText("");
jComboBox_Sex.setSelectedIndex(0);
jComboBox_Status.setSelectedIndex(0);
}
public void input() {
int sex = jComboBox_Sex.getSelectedIndex();
int status = jComboBox_Status.getSelectedIndex();
String xuehao = jTextField_SN.getText().trim(),
xingming = jTextField_Name.getText().trim(),
shenfenzhenghao = jTextField_ID.getText().
trim(),
ianling = jTextField_Age.
getText().trim(),
minzu = jTextField_Nation.getText().trim(),
zhuanye = jTextField_Major.getText().
trim(),
yuanxiao = jTextField_College.
getText().trim(),
nianji = jTextField_Grade.getText().trim(),
banji = jTextField_Class.getText().
trim(),
jiudu = gradeStatus[status],
xingbie = studentSex[sex],
beizhu = jTextField_Other.getText().
trim();
// System.out.println(xuehao);
// System.out.println(jiudu);
if (xuehao.equals("") || xingming.equals("")) {
JOptionPane.showMessageDialog(this, "学生的学号和姓名皆不能为空!",
"注意!", 2);
}
if (shenfenzhenghao.equals("")) {
JOptionPane.showMessageDialog(this, "学生的身份证号码不能为空!",
"注意!", 2);
}if(!shenfenzhenghao.equals("")){
for(int i=0;i<shenfenzhenghao.length();i++){
if((int)shenfenzhenghao.charAt(0)){}
}
}
}
public void jComboBox1_actionPerformed(ActionEvent e) {
}
public void jButton_Reset_actionPerformed(ActionEvent e) {
reset();
}
public void jButton_GoOn_actionPerformed(ActionEvent e) {
if (hasInput == false) {
try {
JOptionPane.showMessageDialog(this, "请将刚才输入的信息录入,否则它们将会丢失!",
"注意!", 1);
} catch (Exception message) {}
} else {
hasInput = false;
reset();
}
}
public void jButton_Cancel_actionPerformed(ActionEvent e) {
dispose();
}
public void jButton_OK_actionPerformed(ActionEvent e) {
input();
hasInput = true;
}
public static void main(String[] args) {
new InputBasicInfo(new AFrame(), true);
}
}
class InputBasicInfo_jButton_OK_actionAdapter implements ActionListener {
private InputBasicInfo adaptee;
InputBasicInfo_jButton_OK_actionAdapter(InputBasicInfo adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jButton_OK_actionPerformed(e);
}
}
class InputBasicInfo_jButton_Cancel_actionAdapter implements ActionListener {
private InputBasicInfo adaptee;
InputBasicInfo_jButton_Cancel_actionAdapter(InputBasicInfo adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jButton_Cancel_actionPerformed(e);
}
}
class InputBasicInfo_jButton_GoOn_actionAdapter implements ActionListener {
private InputBasicInfo adaptee;
InputBasicInfo_jButton_GoOn_actionAdapter(InputBasicInfo adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jButton_GoOn_actionPerformed(e);
}
}
class InputBasicInfo_jButton_Reset_actionAdapter implements ActionListener {
private InputBasicInfo adaptee;
InputBasicInfo_jButton_Reset_actionAdapter(InputBasicInfo adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jButton_Reset_actionPerformed(e);
}
}
class InputBasicInfo_jComboBox1_actionAdapter implements ActionListener {
private InputBasicInfo adaptee;
InputBasicInfo_jComboBox1_actionAdapter(InputBasicInfo adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jComboBox1_actionPerformed(e);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -