package View;
import javax.swing.*;
import javax.swing.table.DefaultTableModel;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class ScoreView {
public JTable JTa=new JTable();
public void ScoreView() {
//-----------------------------------------------
JFrame j =new JFrame("学生信息管理系统");
j.setSize(1500,800);
j.setLayout(new BorderLayout());
j.setLocationRelativeTo(null);
j.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
j.setResizable(false);
//------------------------------------------------
JMenuBar JMB1=new JMenuBar();
j.add(JMB1,BorderLayout.PAGE_START);
JMB1.setBackground(Color.white);
JMenu JM1=new JMenu("学生信息管理");
JMB1.add(JM1);
JM1.add(new JMenuItem("添加学生信息"));
JM1.addSeparator();
JM1.add(new JMenuItem("删除学生信息"));
JM1.addSeparator();
JM1.add(new JMenuItem("修改学生信息"));
JM1.addSeparator();
JM1.add(new JMenuItem("查询学生信息"));
//------------------------------------------------
JSplitPane JS=new JSplitPane();
j.add(JS);
JPanel JP1=new JPanel();//左面板内容
JP1.setBackground(Color.gray);
JS.setLeftComponent(JP1);
JPanel JP2=new JPanel();//右面板内容
JS.setRightComponent(JP2);
JS.setResizeWeight(0.02);
//------------------------------------------------
//添加学生面板
JPanel JP3=new JPanel();
JP1.add(JP3);
JP3.setLayout(new GridLayout(8,0));
JPanel tJP=new JPanel();
JLabel JL=new JLabel("添加学生信息");
JL.setFont(new Font("微软雅黑",Font.BOLD,20));
tJP.add(JL);
JP3.add(tJP);
JPanel tJP1=new JPanel();
JLabel JL1=new JLabel("学号:");
JTextField JT1=new JTextField(20);
tJP1.add(JL1);
tJP1.add(JT1);
JP3.add(tJP1);
JPanel tJP2=new JPanel();
JLabel JL2=new JLabel("姓名:");
JTextField JT2=new JTextField(20);
tJP2.add(JL2);
tJP2.add(JT2);
JP3.add(tJP2);
JPanel tJP3=new JPanel();
JLabel JL3=new JLabel("班级:");
JTextField JT3=new JTextField(20);
tJP3.add(JL3);
tJP3.add(JT3);
JP3.add(tJP3);
JPanel tJP4=new JPanel();
JLabel JL4=new JLabel("专业:");
JTextField JT4=new JTextField(20);
tJP4.add(JL4);
tJP4.add(JT4);
JP3.add(tJP4);
JPanel tJP5=new JPanel();
JLabel JL5=new JLabel("电话:");
JTextField JT5=new JTextField(20);
tJP5.add(JL5);
tJP5.add(JT5);
JP3.add(tJP5);
ButtonGroup BUG=new ButtonGroup();
JPanel tJP6=new JPanel();
JLabel JL6=new JLabel("性别:");
JRadioButton JR1=new JRadioButton();
JLabel JL7=new JLabel("男");
JR1.setSelected(true);
JRadioButton JR2=new JRadioButton();
JLabel JL8=new JLabel("女");
BUG.add(JR1);
BUG.add(JR2);
tJP6.add(JL6);
tJP6.add(JR1);
tJP6.add(JL7);
tJP6.add(JR2);
tJP6.add(JL8);
JP3.add(tJP6);
JPanel tJP7=new JPanel();
JButton JB1=new JButton("提交");
tJP7.add(JB1);
JP3.add(tJP7);
JP2.add(JTa);
JScrollPane JS1=new JScrollPane(JTa);
JTa.getTableHeader().setFont(new Font("微软雅黑", Font.PLAIN,20));
JTa.setFont(new Font("微软雅黑", Font.PLAIN,15));
JTa.setRowHeight(20);
JS1.setBounds(0,0,1200,500);
JP2.add(JS1);
f();
JB1.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
if
(JT1.getText().equals("")||JT2.getText().equals("")||JT3.getText().equals("")||JT4.getText().equals("")||JT5.getText().equals("")
) {
JOptionPane.showMessageDialog(null,"所填信息不能为空!");
}else {
}
}
});
//------------------------------------------------
j.setVisible(true);
}