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

📄 departmentsearchpanel.java~13~

📁 使用JBuilder基于Oracle数据库的课程作业
💻 JAVA~13~
字号:
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);
        add(classInfoPanel, new XYConstraints(340, 0, 670, 470));
        initialize(cno,e);
    }

    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 + -