?? dormsearchpanel.java~3~
字號:
package StudentManageSystem.factionpanels.searchpanel;
import StudentManageSystem.factionpanels.infopanel.CollegeInfoPanel;
import javax.swing.tree.DefaultMutableTreeNode;
import java.sql.ResultSet;
import StudentManageSystem.link.SQLRunner;
import java.sql.SQLException;
import StudentManageSystem.factionpanels.infopanel.DormInfoPanel;
public class DormSearchPanel extends SearchPanel {
public DormSearchPanel(String cno, boolean e){
infoPanel=new DormInfoPanel(e);
initialize(cno,e);
}
public void addNodes() {
try {
top=new DefaultMutableTreeNode("內大");
ResultSet rdp=SQLRunner.getResult("select distinct build_no from dormitory");
while (rdp.next()) {
String dno=rdp.getString("build_no");
String dpname="號樓";
DefaultMutableTreeNode dp=new DefaultMutableTreeNode(dno+dpname);
top.add(dp);
ResultSet rcl=SQLRunner.getResult("select * from dormitory where build_no='"+dno+"'");
while (rcl.next()) {
String clno=rcl.getString("APARTMENT_NO");
//System.out.println(clno);
String 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,1);
showTableView("select * from dormitory");
}else if(sub.trim().equals("樓")){
String cno=s.substring(0,1);
showTableView("select * from dormitory where build_no='"+cno+"'");
}else{
String cno=s.substring(0,3);
showLeavesView(cno);
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -