关于树的焦点 再问一下,通过节点的名称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(); } }); java Graphics内存问题 关于delete键触发的问题 如何得到远程定义的类 JAVA里计时器 请教6条问题 java字符串判断中文 请问如何在web页面调用word,并将所有的所有表单参数调的word中排版、打印。 有哪位高手肯帮小弟一个忙吗?我碰到了一个大难题!关于数组方面的! 我有较好的C++基础,想学java,大家推荐几本书吧,一定要自己看过的。谢谢! 刨根问底:java调用构造函数与产生对象的关系 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();
}
});