⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 myshow.java

📁 学生信息管理系统 还没有连数据库 ,界面做的也不是很好看
💻 JAVA
字号:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;

//定义Myshow类,显示学生信息
public class Myshow extends JFrame implements ActionListener
{
	//定义标签等
	JLabel prompt1,prompt2,prompt3,prompt4,prompt5,prompt6,prompt7,prompt8,oldp,newp1,newp2,inp;
	JTextField op1,op2,op3,op4,op5,op6,op7,op8,inp1;
	JTextArea allstutext;
	JPasswordField oldpin,newpin1,newpin2;
	JButton xiugai,retu,ok1,ok2,ok3,ok4,ok5,se,alstu,append,dele,allstu;//

	Myshow()//构造函数进行初始化
	{
		super("学生信息系统");

		//在两个界面都显示的部件
		xiugai=new JButton("修改密码");
		retu=new JButton("退出");
		ok1=new JButton("确定");
		ok2=new JButton("确定");
		ok3=new JButton("确定");
		ok4=new JButton("确定");
		ok5=new JButton("确定");
                allstu=new JButton("显示所有学生信息");

		//显示学生基本信息的各个部件
        prompt1=new JLabel("学号");
		prompt2=new JLabel("姓名");
		prompt3=new JLabel("性别");
		prompt4=new JLabel("专业");
		prompt5=new JLabel("年级");
		prompt6=new JLabel("生日");
		prompt7=new JLabel("地址");
		prompt8=new JLabel("电话");
		op1=new JTextField();
		op2=new JTextField();
		op3=new JTextField();
		op4=new JTextField();
		op5=new JTextField();
		op6=new JTextField();
		op7=new JTextField();
		op8=new JTextField();
		allstutext=new JTextArea();//20,15

		//显示修改密码的各个部件
		oldp=new JLabel("请输入原始密码");oldpin=new JPasswordField();
		newp1=new JLabel("请输入新密码");newpin1=new JPasswordField();
		newp2=new JLabel("请再次输入新密码");newpin2=new JPasswordField();

                //显示管理员信息及可操作的各个部件
		inp=new JLabel("请输入学生的学号");inp1=new JTextField();//在教师和管理员界面都显示
		se=new JButton("查看学生信息");//在教师和管理员界面都显示
		alstu=new JButton("修改学生信息");
		append=new JButton("添加学生信息");
	        dele=new JButton("删除学生信息");

		Container c=getContentPane();//定义容器,将各部件加入
		c.setLayout(GridLayout(null));
		c.add(allstutext);
		c.add(prompt1);c.add(op1);
		c.add(prompt2);c.add(op2);
		c.add(prompt3);c.add(op3);
		c.add(prompt4);c.add(op4);
		c.add(prompt5);c.add(op5);
		c.add(prompt6);c.add(op6);
		c.add(prompt7);c.add(op7);
		c.add(prompt8);c.add(op8);
		c.add(allstu);
                c.add(se);
                c.add(alstu);
                c.add(append);
                c.add(dele);
		c.add(oldp);c.add(oldpin);
		c.add(newp1);c.add(newpin1);
		c.add(newp2);c.add(newpin2);
                c.add(xiugai);
                c.add(inp);c.add(inp1);
		c.add(allstutext);
		c.add(ok1);c.add(ok2);c.add(ok3);c.add(ok4);c.add(ok5);
		c.add(retu);

		c.setBackground(Color.gray);//设置背景颜色
		prompt1.setBounds(100,50,80,40);op1.setBounds(200,50,250,40);
		prompt2.setBounds(100,100,80,40);op2.setBounds(200,100,250,40);
		prompt3.setBounds(100,150,80,40);op3.setBounds(200,150,250,40);
		prompt4.setBounds(100,200,80,40);op4.setBounds(200,200,250,40);
		prompt5.setBounds(100,250,80,40);op5.setBounds(200,250,250,40);
		prompt6.setBounds(100,300,80,40);op6.setBounds(200,300,250,40);
		prompt7.setBounds(100,350,80,40);op7.setBounds(200,350,250,40);
		prompt8.setBounds(100,400,80,40);op8.setBounds(200,400,250,40);

		ok1.setBounds(450,500,80,40);ok2.setBounds(450,500,80,40);
		ok3.setBounds(450,500,80,40);ok4.setBounds(450,500,80,40);
		ok5.setBounds(450,500,80,40);
		retu.setBounds(550,500,80,40);

		oldp.setBounds(200,100,200,40);
		oldpin.setBounds(200,150,200,40);
		newp1.setBounds(200,200,200,40);
		newpin1.setBounds(200,250,200,40);
		newp2.setBounds(200,300,200,40);
		newpin2.setBounds(200,350,200,40);

		inp.setBounds(350,200,200,40);
		inp1.setBounds(350,250,200,40);

		se.setBounds(100,100,200,60);
		alstu.setBounds(100,180,200,60);
		append.setBounds(100,260,200,60);
		dele.setBounds(100,340,200,60);
		allstu.setBounds(100,420,200,60);

		xiugai.setBounds(100,500,150,40);
		allstutext.setBounds(40,40,600,420);




       //打开事件监听
		xiugai.addActionListener(this);
		retu.addActionListener(this);
		ok1.addActionListener(this);
		ok2.addActionListener(this);
		ok3.addActionListener(this);
		ok4.addActionListener(this);
		ok5.addActionListener(this);
		allstu.addActionListener(this);
		se.addActionListener(this);
		alstu.addActionListener(this);
		append.addActionListener(this);
		dele.addActionListener(this);

		//设置显示情况
		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);
		ok1.setVisible(false);
		ok2.setVisible(false);
		ok3.setVisible(false);
		ok4.setVisible(false);
		ok5.setVisible(false);
		se.setVisible(false);
		allstu.setVisible(false);
		allstutext.setVisible(false);
		alstu.setVisible(false);
		append.setVisible(false);
		dele.setVisible(false);
		oldp.setVisible(false);
		oldpin.setVisible(false);
		newp1.setVisible(false);
		newpin1.setVisible(false);
		newp2.setVisible(false);
		newpin2.setVisible(false);
		inp.setVisible(false);
		inp1.setVisible(false);
		setSize(450,350);//设置界面大小
		show();
	}

	public void fuzhi(Student st)//给文本输出赋值
	{
		op1.setText(Integer.toString(st.getnumber()));
		op2.setText(st.getname());
		op3.setText(st.getsex());
		op4.setText(st.getsdept());
		op5.setText(st.getgrade());
		op6.setText(st.getbirthday());
		op7.setText(st.getaddress());
		op8.setText(Long.toString(st.getphone()));
	}
	public void actionPerformed(ActionEvent e)
	{
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -