public class TabularMibTreeModel extends DefaultTreeModel {
public TabularMibTreeModel() {
super(new DefaultMutableTreeNode("Tablular MIBs"));
loadParentMibs();
}
@Override
public void reload() {
super.reload();
}
private void loadParentMibs() {
try {
ResultSet rs=Application.getDBHandler().executeQuery(SQLQueries.SELECT_TABULARMIBS_PARENT);
while(rs.next()){
String entryOID = rs.getString("mt_oid");
DefaultMutableTreeNode node=new DefaultMutableTreeNode(new MibNode(entryOID, "Parent"));
node.add(new DefaultMutableTreeNode(Boolean.TRUE));
((DefaultMutableTreeNode) getRoot()).insert(node,((DefaultMutableTreeNode)getRoot()).getChildCount())
node=null;
}
} catch (SQLException e) {
e.printStackTrace();
}
}
}
我刚开始研究JTree。我创建了一个以 entryOID 作为父级的 jtree。实际上在后端 entryOID 有它的父级。我能得到这个参数吗?如何通过避免 entryOID 来显示它?请帮忙?