public void valueChanged(TreeSelectionEvent event) { // the user selected a different node--update description TreePath[] paths = tree.getSelectionPaths(); if (path == null) return; String description; for(int j=0;j<paths.length;j++){ DefaultMutableTreeNode selectedNode = (DefaultMutableTreeNode)paths[j].getLastPathComponent(); Class c = (Class)selectedNode.getUserObject(); if (description==null){ description = getFieldDescription(c); else description =description.concat("---").concat(getFieldDescription(c)); } textArea.setText(description); }
to xmvigour(微电) 你给的代码是解决multi-selected的问题吗? 我看不太明白,可以帮忙解释一下吗? 谢谢
{ // the user selected a different node--update description
TreePath[] paths = tree.getSelectionPaths();
if (path == null) return;
String description;
for(int j=0;j<paths.length;j++){
DefaultMutableTreeNode selectedNode
= (DefaultMutableTreeNode)paths[j].getLastPathComponent();
Class c = (Class)selectedNode.getUserObject();
if (description==null){
description = getFieldDescription(c);
else
description =description.concat("---").concat(getFieldDescription(c));
}
textArea.setText(description);
}
你给的代码是解决multi-selected的问题吗?
我看不太明白,可以帮忙解释一下吗?
谢谢
然后用一个循环来处理每一个选择item。
假定: 对一家公司的员工进行管理:
包括人员名字,出生日期,加入公司的年份,那个部门(用ring0---ring9表示10个部门) ,工资标准等(多多不限)
要求有对(假如有员工改名, 可以实现改名, 尽管使用中不常见, 但主要是为了实现面向对象思想)(更改工资标准)(开除员工和增加员工)(通过工龄即加入公司的时间来对员工进行排序, 同一年的可随便排)(通过部门的对员工排序, 个部门的集中在一起显示,譬如ring0的排了下了跟着就是全是ring1部门的)
请兄弟们快点回帖, 把源代码和程序发给我, 搞定后就给200分!!!
这是我期末考试的题目, 兄弟们要快快快!!
我的email : [email protected]
多谢!