📄 myshow1.java
字号:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
public class Myshow1 extends Myshow implements ActionListener//定义子类界面来显示学生
{
Student M;
boolean k1,k2,k3,k4;
Myshow1(boolean a,boolean b,boolean c,boolean d,Student m)//带参构造函数,以三个按钮的显示状况为参数
{
M=m;
boolean k1=a,k2=b,k3=c,k4=d;
prompt1.setVisible(true);
prompt2.setVisible(true);
prompt3.setVisible(true);
prompt4.setVisible(true);
prompt5.setVisible(true);
prompt6.setVisible(true);
prompt7.setVisible(true);
prompt8.setVisible(true);
op1.setVisible(true);
op2.setVisible(true);
op3.setVisible(true);
op4.setVisible(true);
op5.setVisible(true);
op6.setVisible(true);
op7.setVisible(true);
op8.setVisible(true);
xiugai.setVisible(k1);
ok1.setVisible(false);
ok2.setVisible(k2);
ok3.setVisible(k3);
ok4.setVisible(k4);
fuzhi(m);
setSize(2000,2000);
show();
}
public void actionPerformed(ActionEvent e)
{
if(e.getSource()==xiugai)
{
prompt1.setVisible(false);
prompt2.setVisible(false);
prompt3.setVisible(false);
prompt4.setVisible(false);
prompt5.setVisible(false);
prompt6.setVisible(false);
prompt7.setVisible(false);
prompt8.setVisible(false);
op1.setVisible(false);
op2.setVisible(false);
op3.setVisible(false);
op4.setVisible(false);
op5.setVisible(false);
op6.setVisible(false);
op7.setVisible(false);
op8.setVisible(false);
oldp.setVisible(true);
oldpin.setVisible(true);
newp1.setVisible(true);
newpin1.setVisible(true);
newp2.setVisible(true);
newpin2.setVisible(true);
ok1.setVisible(true);
ok2.setVisible(k2);
ok3.setVisible(k3);
ok4.setVisible(k4);
xiugai.setVisible(false);
}
else if(e.getSource()==ok1)//修改密码
{
int s1=Integer.parseInt(oldpin.getText());
int s2=Integer.parseInt(newpin1.getText());
int s3=Integer.parseInt(newpin2.getText());
String s=M.alterpassword(s1,s2,s3);
JOptionPane.showMessageDialog(null,s);
dispose();
new Myshow1(true,false,false,false,M);
}
else if(e.getSource()==ok2)//修改资料
{
Student st=new Student();
M.setall(Integer.parseInt(op1.getText()),op2.getText(),op3.getText(),op4.getText(),op5.getText(),op6.getText(),op7.getText(),Long.parseLong(op8.getText()));
JOptionPane.showMessageDialog(null,"修改成功!");
dispose();
}
else if(e.getSource()==ok3)//添加学生
{
Student s=new Student(Integer.parseInt(op1.getText()),op2.getText(),op3.getText(),op4.getText(),op5.getText(),op6.getText(),op7.getText(),Long.parseLong(op8.getText()));
Xinxi.stu.insertAtBegin(s);
JOptionPane.showMessageDialog(null,"添加成功");
dispose();
}
else if(e.getSource()==ok4)//删除学生
{
dispose();
String s=Xinxi.stu.removeAtId(M);
JOptionPane.showMessageDialog(null,s);
}
else
{
dispose();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -