关于树的焦点 再问一下,通过节点的名称name,可以得到这个节点的Path么?怎么做? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 too easy look down//添加树选取事件 tree.addTreeSelectionListener(new TreeSelectionListener() { public void valueChanged(TreeSelectionEvent event) { //得到选中的树节点 TreePath path = tree.getSelectionPath(); if (path == null) return; DefaultMutableTreeNode thisnode = (DefaultMutableTreeNode) path.getLastPathComponent(); //变量定义 String sql="select EMP_ID,EMP_REALNAME from employee where emp_onjob='1' and emp_dept_id='" ; String deptid=getDeptId(thisnode.toString()); String sqlcondition=deptid+"'"; Vector userVector=new Vector(); int size=0; String temp=""; int rowcount=customModel.getRowCount(); //先移除表中的所有数据,再添加入新的数据 for(int i=rowcount;i>0;i--) { try{ customModel.removeRow(i-1); } catch(Exception ex) { System.out.println(ex.toString()); } } //得到人员信息 try { userVector=client.getUserDetail(sql,sqlcondition); } catch(Exception ex) { System.out.println(ex.toString()); } size=userVector.size(); for(int j=0;j<size;j++) { temp=userVector.get(j).toString(); rowData[0]=getDeptId(temp); rowData[1]=getUserId(temp); customModel.addRow(rowData); //tablemodel } //userVector.removeAllElements(); } }); 求将下边C++的CRC校验代码转换成java格式的? 在类中定义另外一个类的对象数组会出错,求解 notify和notifyAll 高手请进!j2se问题! Spring + Ibatis + c3p0 数据库连接数问题。急。。。 我要学习JAVA 请哥哥姐姐前辈们指点指点我~~谢谢了 求助!!!!!!! 像vc中那样右上角有一个x的面板有对应的java组件吗? 把身上仅有的10分拿出来跪求解答 如何得到一个文件的路径 sourceforge站点为什么进不去了? 好多天了! UDP发广播报文的问题?
tree.addTreeSelectionListener(new TreeSelectionListener()
{
public void valueChanged(TreeSelectionEvent event)
{ //得到选中的树节点
TreePath path = tree.getSelectionPath();
if (path == null) return;
DefaultMutableTreeNode thisnode = (DefaultMutableTreeNode) path.getLastPathComponent();
//变量定义
String sql="select EMP_ID,EMP_REALNAME from employee where emp_onjob='1' and emp_dept_id='" ;
String deptid=getDeptId(thisnode.toString());
String sqlcondition=deptid+"'";
Vector userVector=new Vector();
int size=0;
String temp="";
int rowcount=customModel.getRowCount();
//先移除表中的所有数据,再添加入新的数据
for(int i=rowcount;i>0;i--)
{
try{
customModel.removeRow(i-1);
}
catch(Exception ex)
{
System.out.println(ex.toString());
}
}
//得到人员信息
try
{
userVector=client.getUserDetail(sql,sqlcondition);
}
catch(Exception ex)
{
System.out.println(ex.toString());
}
size=userVector.size();
for(int j=0;j<size;j++)
{
temp=userVector.get(j).toString();
rowData[0]=getDeptId(temp);
rowData[1]=getUserId(temp);
customModel.addRow(rowData);
//tablemodel
}
//userVector.removeAllElements();
}
});