panelforstatus.java
来自「学生学籍管理系统」· Java 代码 · 共 785 行 · 第 1/2 页
JAVA
785 行
}
else if(e.getSource()==refresh){
shuaxin();
}
else if(e.getSource()==setClear){
id.setText("");
name.setText("");
birthPlace.setText("");
testPlace.setText("");
graduateSchool.setText("");
totalScore.setText("");
}
else if(e.getSource()==sea_1.pfsi.handin){
if(sea_1.pfsi.jf_id.getText().equals("")){
JOptionPane.showMessageDialog(null, "请输入学号:");
return;
}
boolean state = psql.weatherExistInStuInfor(sea_1.pfsi.jf_id.getText());
if(!state)
JOptionPane.showMessageDialog(null, "没有此人");
else{
table.setVisible(false);
tm.content.removeAllElements();
jishu = psql.SearchStuInforById(tm.content,sea_1.pfsi.jf_id.getText());
table.setVisible(true);
showNum.setText("人数为:"+jishu);
}
}
else if(e.getSource()==sea_1.pfsco.handin){
table.setVisible(false);
tm.content.removeAllElements();
jishu = psql.SearchStuInforByCollege(tm.content,sea_1.pfsco.college.getSelectedItem());
table.setVisible(true);
showNum.setText("人数为:"+jishu);
}
else if(e.getSource()==sea_1.pfsn.handin){
if(sea_1.pfsi.jf_id.getText().equals("")){
JOptionPane.showMessageDialog(null, "请输入姓名!");
return;
}
else{
table.setVisible(false);
tm.content.removeAllElements();
jishu = psql.SearchStuInforByName(tm.content,sea_1.pfsn.jf_id.getText());
table.setVisible(true);
showNum.setText("人数为:"+jishu);
}
}
else if(e.getSource()==sea_1.pfscla.handin){
table.setVisible(false);
tm.content.removeAllElements();
jishu = psql.SearchStuInforByClasses(tm.content,sea_1.pfscla.classes.getSelectedItem());
table.setVisible(true);
showNum.setText("人数为:"+jishu);
}
else if(e.getSource()==sea_1.pfsnation.handin){
if(sea_1.pfsi.jf_id.getText().equals("")){
JOptionPane.showMessageDialog(null, "请选择或输入民族!");
return;
}
else{
table.setVisible(false);
tm.content.removeAllElements();
jishu = psql.SearchStuInforByNation(tm.content,sea_1.pfsnation.nation.getText());
table.setVisible(true);
showNum.setText("人数为:"+jishu);
}
}
else if(e.getSource()==deleteRow){
psql.DistroyStuInforByID(String.valueOf(tm.getValueAt(tableRow,1)));
shuaxin();
}
else if(e.getSource()==delete||e.getSource()==deleteStuInfor){
del_1.setDisplay(true);
}
else if(e.getSource()==find||e.getSource()==findInfor||e.getSource()==del_1.pDelePer.find){
sea_1.setDisplay(true);
}
else if(e.getSource()==del_1.pDelePer.handin){
if(del_1.pDelePer.jf_id.getText().equals("")){
JOptionPane.showMessageDialog(null, "请输入学号:");
return;
}
boolean state = psql.weatherExistInStuInfor(del_1.pDelePer.jf_id.getText());
if(!state)
JOptionPane.showMessageDialog(null, "没有此人");
else{
psql.DistroyStuInforByID(del_1.pDelePer.jf_id.getText());
shuaxin();
}
}
else if(e.getSource()==del_1.pDeleAll.handin){
psql.DistroyAllStuInfor();
shuaxin();
}
else if(e.getSource()==del_1.pDeleCla.handin){
psql.DistroyStuInforByClasses(del_1.pDeleCla.classes.getSelectedItem());
shuaxin();
}
else if(e.getSource()==del_1.pDeleCol.handin){
psql.DistroyStuInforByCollege(del_1.pDeleCol.college.getSelectedItem());
shuaxin();
}
}
public void shuaxin(){
table.setVisible(false);
tm.content.removeAllElements();
jishu = psql.getStudentInfor(tm.content);
table.setVisible(true);
showNum.setText("人数为:"+jishu);
}
public void textValueChanged(TextEvent e){
if(e.getSource()==id)
{
Infor[0]=id.getText();
}
else if(e.getSource()==name){
Infor[1] = name.getText();
}
else if(e.getSource()==birthPlace){
Infor[3]=birthPlace.getText();
}
else if(e.getSource()==testPlace){
Infor[4]=testPlace.getText();
}
else if(e.getSource()==graduateSchool){
Infor[5]=graduateSchool.getText();
}
else if(e.getSource()==totalScore){
Infor[6]=totalScore.getText();
}
}
public void itemStateChanged(ItemEvent e){
if(e.getItemSelectable()==jrb_male){
Infor[2]="男";
}
else if(e.getItemSelectable()==jrb_female){
Infor[2]="女";
}
else if(e.getSource()==birthYear||e.getItemSelectable()==birthMonth||e.getItemSelectable()==birthDay){
Infor[7] = birthYear.getSelectedItem().trim()+"-"+birthMonth.getSelectedItem().trim()+"-"+birthDay.getSelectedItem().trim();
}
else if(e.getItemSelectable()==nation){
if((nation.getSelectedItem()).equals("其它")){
one.setDisplay(true);
}
else Infor[8] = nation.getSelectedItem();
}
else if(e.getItemSelectable()==eductionalSystem){
Infor[9] = eductionalSystem.getSelectedItem();
}
//0id,1name,2sex,3birthPlace,4testPlace,5graduateSchool,6totalScore
//7birthDate,8nation,9eductionalSystem,10languageType,11degree,
//12entranceDate16entranceDay,13politicsType,
else if(e.getItemSelectable()==languageType){
Infor[10] = languageType.getSelectedItem();
}
else if(e.getItemSelectable()==degree){
Infor[11]= degree.getSelectedItem();
}
else if(e.getItemSelectable()==entranceYear||e.getItemSelectable()==entranceMonth||e.getItemSelectable()==entranceDay){
Infor[12] = entranceYear.getSelectedItem().trim()+"-"+entranceMonth.getSelectedItem().trim()+"-"+entranceDay.getSelectedItem().trim();
}
else if(e.getItemSelectable()==politicsType){
Infor[13] = politicsType.getSelectedItem();
}
else if(e.getItemSelectable()==college){
addIntoClasses(college.getSelectedItem());
Infor[14] =college.getSelectedItem();
}
else if(e.getItemSelectable()==classes){
Infor[15] = classes.getSelectedItem();
}
}
public void addIntoClasses(String college){
classes.removeAll();
for(int i=3;i<7;i++)
for(int j=0;j<4;j++)
classes.addItem(college+"0"+i+(j+1)+"班");
}
public boolean checkDate(String dateStr){
boolean result = false;
DateFormat dateFormat1 = DateFormat.getDateInstance();
try{
dateFormat1.parse(dateStr);
result = true;
}catch(Exception ex){
result = false;
}
return result;
}
}
class Table_Model extends AbstractTableModel {
public Vector content = new Vector();
private String[] title_name ={"序号","学号","姓名","性别","出生地","考区","毕业学校","高考总分","出生日期","民族","学制","外语语种","学历","入学日期","政治面貌","院系","班级"};
Object TMInfor [] = new Object[17];
public String getColumnName(int col) {
return title_name[col];
}
public int getColumnCount() {
return title_name.length;
}
public int getRowCount() {
return content.size();
}
public Object getValueAt(int row, int col) {
return ( (Vector) content.get(row)).get(col);
}
public boolean isCellEditable(int rowIndex, int columnIndex) {
return true;
}
public void setValueAt(Object value, int row, int col) {
// content.setElementAt(value,)
for(int i=0;i<17;i++)
TMInfor[i] = ((Vector)content.get(row)).get(i);
TMInfor[col] = value;
Vector temp_v = new Vector(17);
for(int i=0;i<17;i++)
temp_v.add(TMInfor[i]);
content.setElementAt(temp_v,row);
fireTableCellUpdated(row, col);
}
public void mySetValueAt(Object value, int row, int col) {
//((Vector)content.elementAt(row)).elementAt(col) = value;
}
}
class Nation implements ActionListener,ItemListener{
JDialog jdl;
JRadioButton jrb_nation[]=new JRadioButton[56];
ButtonGroup nations= new ButtonGroup();
String onesNation="";
JButton confirm = new JButton("确定");
JButton cancel = new JButton("取消");
Nation(JFrame f,String s,boolean b){
jdl = new JDialog(f,s,b);
jrb_nation[0]=new JRadioButton("毛南族");jrb_nation[1]=new JRadioButton("仡佬族");jrb_nation[2]=new JRadioButton("锡伯族");jrb_nation[3]=new JRadioButton("阿昌族");
jrb_nation[4]=new JRadioButton("普米族");jrb_nation[5]=new JRadioButton("塔吉克族");jrb_nation[6]=new JRadioButton("怒族");jrb_nation[7]=new JRadioButton("乌孜别克族");
jrb_nation[8]=new JRadioButton("俄罗斯族 ");jrb_nation[9]=new JRadioButton("鄂温克族");jrb_nation[10]=new JRadioButton("德昂族 ");jrb_nation[11]=new JRadioButton("保安族");
jrb_nation[12]=new JRadioButton("蒙古族");jrb_nation[13]=new JRadioButton("回族");jrb_nation[14]=new JRadioButton("藏族");jrb_nation[15]=new JRadioButton("维吾尔族");
jrb_nation[16]=new JRadioButton("苗族");jrb_nation[17]=new JRadioButton("彝族");jrb_nation[18]=new JRadioButton("壮族");jrb_nation[19]=new JRadioButton("布依族");
jrb_nation[20]=new JRadioButton("朝鲜族");jrb_nation[21]=new JRadioButton("满族");jrb_nation[22]=new JRadioButton("侗族");jrb_nation[23]=new JRadioButton("瑶族");
jrb_nation[24]=new JRadioButton("白族");jrb_nation[25]=new JRadioButton("土家族");jrb_nation[26]=new JRadioButton("哈尼族");jrb_nation[27]=new JRadioButton("哈萨克族");
jrb_nation[28]=new JRadioButton("傣族");jrb_nation[29]=new JRadioButton("黎族");jrb_nation[30]=new JRadioButton("傈僳族");jrb_nation[31]=new JRadioButton("佤族");
jrb_nation[32]=new JRadioButton("畲族");jrb_nation[33]=new JRadioButton("高山族");jrb_nation[34]=new JRadioButton("拉祜族");jrb_nation[35]=new JRadioButton("柯尔克孜族");
jrb_nation[36]=new JRadioButton("东乡族");jrb_nation[37]=new JRadioButton("纳西族");jrb_nation[38]=new JRadioButton("景颇族");jrb_nation[39]=new JRadioButton("水族");
jrb_nation[40]=new JRadioButton("土族");jrb_nation[41]=new JRadioButton("达斡尔族");jrb_nation[42]=new JRadioButton("仫佬族");jrb_nation[43]=new JRadioButton("裕固族");
jrb_nation[44]=new JRadioButton("羌族");jrb_nation[45]=new JRadioButton("布朗族");jrb_nation[46]=new JRadioButton("撒拉族");jrb_nation[47]=new JRadioButton("鄂伦春族");
jrb_nation[48]=new JRadioButton("京族 ");jrb_nation[49]=new JRadioButton("塔塔尔族");jrb_nation[50]=new JRadioButton("独龙族");jrb_nation[51]=new JRadioButton("赫哲族");
jrb_nation[52]=new JRadioButton("门巴族");jrb_nation[53]=new JRadioButton("珞巴族");jrb_nation[54]=new JRadioButton("基诺族");jrb_nation[55]=new JRadioButton("汉族");
JPanel two = new JPanel();
JPanel three = new JPanel();
three.setLayout(new FlowLayout(FlowLayout.CENTER));
three.add(confirm);three.add(cancel);
confirm.addActionListener(this);
cancel.addActionListener(this);
for(int i=0;i<56;i++){
nations.add(jrb_nation[i]);
two.add(jrb_nation[i]);
jrb_nation[i].addItemListener(this);
}
two.setLayout(new GridLayout(8,7,2,2));
jdl.add(two);
jdl.add(three,BorderLayout.SOUTH);
jdl.pack();
}
void setDisplay(Boolean tf){
jdl.setVisible(tf);
}
public void itemStateChanged(ItemEvent e){
for(int i=0;i<56;i++){
if(e.getItemSelectable()==jrb_nation[i])
onesNation = jrb_nation[i].getText();
}
}
public String returnNation(){
return this.onesNation;
}
public void actionPerformed(ActionEvent e){
if(e.getSource()==cancel){
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?