mytreemodellistener.java
来自「图书管理系统毕业设计源代码,图书管理系统毕业设计源代码图书管理系统毕业设计源代码」· Java 代码 · 共 51 行
JAVA
51 行
/* * MyTreeModelListener.java * * Created on 2006年4月27日, 上午7:56 * * To change this template, choose Tools | Options and locate the template under * the Source Creation and Management node. Right-click the template and choose * Open. You can then make changes to the template in the Source Editor. */package myClass;/** * * @author wang */import javax.swing.tree.*;import javax.swing.event.*;public class MyTreeModelListener implements TreeModelListener { /** Creates a new instance of MyTreeModelListener */ public void treeNodesChanged(TreeModelEvent e) { DefaultMutableTreeNode node; node = (DefaultMutableTreeNode) (e.getTreePath().getLastPathComponent()); /* * If the event lists children, then the changed * node is the child of the node we've already * gotten. Otherwise, the changed node and the * specified node are the same. */ try { int index = e.getChildIndices()[0]; node = (DefaultMutableTreeNode) (node.getChildAt(index)); } catch (NullPointerException exc) {} System.out.println("The user has finished editing the node."); System.out.println("New value: " + node.getUserObject()); } public void treeNodesInserted(TreeModelEvent e) { } public void treeNodesRemoved(TreeModelEvent e) { } public void treeStructureChanged(TreeModelEvent e) { }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?