main.java
来自「电子与信息工程学生信息管理系统」· Java 代码 · 共 1,558 行 · 第 1/5 页
JAVA
1,558 行
displayTable(1);
return;
}
return;
}
four=two.next;
three=first;
four.prev=three;
three.next=four;
if(click==1)four=new SortID().SortStudentID(four,listlenth);
if(click==0)four=new UnSortID().SortStudentID(four,listlenth);
first=four;
for(int i=0;i<listlenth-1;i++){first=first.next;}
first.next=null;
four.prev=two;
two.next=four;
shuaxin();
page=1;
displayTable(page);
}
//******************************************************************************button_sortId action
//******************************************************************************button_sortName action
if(obj==button_sortName){
click++;
click=click%2;
if(listlenth==1||listlenth==0)return;
if(listlenth==2){
if(two.next.name.compareToIgnoreCase(first.name)<0){
first.next=two.next;
first.prev=two;
two.next.next=null;
two.next.prev=first;
two.next=first;
first=first.next;
shuaxin();
displayTable(1);
return;
}
return;
}
four=two.next;
three=first;
four.prev=three;
three.next=four;
if(click==1)four=new SortName().SortStudentName(four,listlenth);
if(click==0)four=new UnSortName().SortStudentName(four,listlenth);
first=four;
for(int i=0;i<listlenth-1;i++){first=first.next;}
first.next=null;
four.prev=two;
two.next=four;
shuaxin();
page=1;
displayTable(page);
}
//******************************************************************************button_sortName action
//******************************************************************************button_sortSex action
if(obj==button_sortSex){
if(listlenth==1||listlenth==0)return;
if(listlenth==2){
if(two.next.sex.compareToIgnoreCase(first.sex)<0){
first.next=two.next;
first.prev=two;
two.next.next=null;
two.next.prev=first;
two.next=first;
first=first.next;
shuaxin();
displayTable(1);
return;
}
return;
}
four=two.next;
three=first;
four.prev=three;
three.next=four;
four=new SortSex().SortStudentSex(four,listlenth);
first=four;
for(int i=0;i<listlenth-1;i++){first=first.next;}
first.next=null;
four.prev=two;
two.next=four;
shuaxin();
page=1;
displayTable(page);
}
//******************************************************************************button_sortSex action
//******************************************************************************button_sortAge action
if(obj==button_sortAge){
if(listlenth==1||listlenth==0)return;
if(listlenth==2){
if(Integer.parseInt(two.next.age)<Integer.parseInt(first.age)){
first.next=two.next;
first.prev=two;
two.next.next=null;
two.next.prev=first;
two.next=first;
first=first.next;
shuaxin();
displayTable(1);
return;
}
return;
}
four=two.next;
three=first;
four.prev=three;
three.next=four;
four=new SortAge().SortStudentAge(four,listlenth);
first=four;
for(int i=0;i<listlenth-1;i++){first=first.next;}
first.next=null;
four.prev=two;
two.next=four;
shuaxin();
page=1;
displayTable(page);
}
//******************************************************************************button_sortAge action
//******************************************************************************button_sortGrade action
if(obj==button_sortGrade){
if(listlenth==1||listlenth==0)return;
if(listlenth==2){
if(two.next.grade.compareToIgnoreCase(first.grade)<0){
first.next=two.next;
first.prev=two;
two.next.next=null;
two.next.prev=first;
two.next=first;
first=first.next;
shuaxin();
displayTable(1);
return;
}
return;
}
four=two.next;
three=first;
four.prev=three;
three.next=four;
four=new SortGrade().SortStudentGrade(four,listlenth);
first=four;
for(int i=0;i<listlenth-1;i++){first=first.next;}
first.next=null;
four.prev=two;
two.next=four;
shuaxin();
page=1;
displayTable(page);
}
//******************************************************************************button_sortGrade action
//******************************************************************************button_sortGclass action
if(obj==button_sortGclass){
if(listlenth==1||listlenth==0)return;
if(listlenth==2){
if(Integer.parseInt(two.next.gclass)<Integer.parseInt(first.gclass)){
first.next=two.next;
first.prev=two;
two.next.next=null;
two.next.prev=first;
two.next=first;
first=first.next;
shuaxin();
displayTable(1);
return;
}
return;
}
four=two.next;
three=first;
four.prev=three;
three.next=four;
four=new SortGclass().SortStudentGclass(four,listlenth);
first=four;
for(int i=0;i<listlenth-1;i++){first=first.next;}
first.next=null;
four.prev=two;
two.next=four;
shuaxin();
page=1;
displayTable(page);
}
//******************************************************************************button_sortGclass action
//******************************************************************************button_search action
if(obj==button_search){
String stri = idNameCombo[comboBox_idName.getSelectedIndex()];
String searchname=textName.getText();
String searchid=textId.getText();
if(stri.equals("accurate")){
if((searchname.length()==0||searchname.length()>9)&&(searchid.length()==0||searchid.length()>9)){
Object[] options = {"yes"};
String str = "lenth wrong!";
JOptionPane.showOptionDialog(null,str,"warning",JOptionPane.DEFAULT_OPTION,
JOptionPane.WARNING_MESSAGE,null,options,options[0]);
return;}
if(searchname.length()!=0&&searchid.length()!=0){
four=two.next;
three=first;
four.prev=three;
three.next=four;
int q=listlenth;
while(q>0){if(four.id.equals(searchid)){break;}four=four.next;q--;}
if(q==0||!four.name.equals(searchname)){Object[] options = {"yes"};
String str = "none!";
JOptionPane.showOptionDialog(null,str,"warning",JOptionPane.DEFAULT_OPTION,
JOptionPane.WARNING_MESSAGE,null,options,options[0]);
return;}
first=four;
for(int i=0;i<listlenth-1;i++){four=four.prev;}
first.next=null;
four.prev=two;
two.next=four;
shuaxin();
page=1;
displayTable(page); return;
}
if(searchid.length()!=0){
if(searchid.length()==0||searchid.length()>9){
Object[] options = {"yes"};
String str = "id lenth wrong!";
JOptionPane.showOptionDialog(null,str,"warning",JOptionPane.DEFAULT_OPTION,
JOptionPane.WARNING_MESSAGE,null,options,options[0]);
return;
}
four=two.next;
three=first;
four.prev=three;
three.next=four;
int q=listlenth;
while(q>0){
if(four.id.equals(searchid)){
break;
}
four=four.next;
q--;
}
if(q==0){Object[] options = {"yes"};
String str = "none!";
JOptionPane.showOptionDialog(null,str,"warning",JOptionPane.DEFAULT_OPTION,
JOptionPane.WARNING_MESSAGE,null,options,options[0]);
return;}
first=four;
for(int i=0;i<listlenth-1;i++){four=four.prev;}
first.next=null;
four.prev=two;
two.next=four;
shuaxin();
page=1;
displayTable(page);
return;
}
if(searchname.length()!=0){
if(searchname.length()==0||searchname.length()>9){
Object[] options = {"yes"};
String str = "name lenth wrong!";
JOptionPane.showOptionDialog(null,str,"warning",JOptionPane.DEFAULT_OPTION,
JOptionPane.WARNING_MESSAGE,null,options,options[0]);
return;
}
four=two.next;
three=first;
four.prev=three;
three.next=four;
four=new SortName().SortStudentName(four,listlenth);
first=four;
for(int i=0;i<listlenth-1;i++){first=first.next;}
int q=listlenth;
while(q>0){
if(first.name.equals(searchname)){
break;
}
first=first.prev;
q--;
}
if(q==0){Object[] options = {"yes"};
String str = "none!";
JOptionPane.showOptionDialog(null,str,"warning",JOptionPane.DEFAULT_OPTION,
JOptionPane.WARNING_MESSAGE,null,options,options[0]);
return;}
four=first;
for(int i=0;i<listlenth-1;i++){four=four.prev;}
first.next=null;
four.prev=two;
two.next=four;
shuaxin();
page=1;
displayTable(page);
return;
}
}
if(stri.equals("contains")){
if((searchname.length()==0||searchname.length()>9)&&(searchid.length()==0||searchid.length()>9)){
Object[] options = {"yes"};
String str = " lenth wrong!";
JOptionPane.showOptionDialog(null,str,"warning",JOptionPane.DEFAULT_OPTION,
JOptionPane.WARNING_MESSAGE,null,options,options[0]);
return;}
if(searchid.length()!=0&&searchname.length()!=0){
Student stu=two;//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@id&&name is not null
three=new Student();
four=new Student();
three.prev=null;
four.next=null;
int o=0;
for(int i=0;i<listlenth;i++){
stu=stu.next;
if(stu.id.contains(searchid)&&stu.name.contains(searchname)){
four.prev=new Student();
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?