?? departmentsearchpanel.java~12~
字號:
package StudentManageSystem.factionpanels.searchpanel;
import StudentManageSystem.factionpanels.infopanel.TeacherInfoPanel;
import java.awt.event.ActionEvent;
import java.sql.ResultSet;
import StudentManageSystem.link.SQLRunner;
import javax.swing.tree.DefaultMutableTreeNode;
import java.sql.SQLException;
import StudentManageSystem.factionpanels.infopanel.DepartmentInfoPanel;
import StudentManageSystem.factionpanels.infopanel.ClassInfoPanel;
import com.borland.jbcl.layout.XYConstraints;
public class DepartmentSearchPanel extends SearchPanel {
ClassInfoPanel classInfoPanel;
public DepartmentSearchPanel(String cno, boolean e){
infoPanel=new DepartmentInfoPanel(e);
classInfoPanel=new ClassInfoPanel(e);
initialize(cno,e);add(classInfoPanel, new XYConstraints(170, 0, 670, 470));
}
public void addNodes() {
try {
if(top!=null)top.removeAllChildren();
ResultSet rs=SQLRunner.getResult("select * from college where college_no='"+college_no+"'");
if(!rs.next())return;
top=new DefaultMutableTreeNode(college_no+rs.getString("coname"));
ResultSet rdp=SQLRunner.getResult("select * from department where department.college_no='"+college_no+"'");
while (rdp.next()) {
String dno=rdp.getString("DEPART_NO");
String dpname=rdp.getString("dpname");
DefaultMutableTreeNode dp=new DefaultMutableTreeNode(dno+'/'+dpname);
top.add(dp);
ResultSet rcl=SQLRunner.getResult("select * from class where class.depart_no='"+dno+"'");
while (rcl.next()) {
String clno=rcl.getString("class_no");
System.out.println(clno);
String clname=rcl.getString("clname");
DefaultMutableTreeNode cl=new DefaultMutableTreeNode(clno+'/'+clname);
dp.add(cl);
}
}
} catch (SQLException ex) {
}
}
public void setView(String s){
/*String sub=(s.trim());
sub=sub.substring(sub.length()-1,sub.length());
if(sub.trim().equals("?")){
String cno=s.substring(0,2);
showTableView("select * from department where department.college_no='"+cno+"'");
}else{
String sno=s.substring(0,2);
showLeavesView(sno);
}*/
String sub=(s.trim());
sub=sub.substring(sub.length()-1,sub.length());
if(sub.trim().equals("?")){
String cno=s.substring(0,2);
showTableView("select * from department where department.college_no='"+cno+"'");
}else if(sub.trim().equals("?")){
String dno=s.substring(0,2);
classInfoPanel.setVisible(false);
showLeavesView(dno);
}else{
String clno=s.substring(0,4);
tablePanel.setVisible(false);
welcomePanel.setVisible(false);
infoPanel.setVisible(false);
classInfoPanel.setVisible(true);
classInfoPanel.setAllInfo(clno);
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -