Java Swing O Reilly This sole method of (Hosting web)
Sunday, August 26th, 2007Java Swing O Reilly This sole method of the TreeExpansionEvent returns the path that was collapsed or expanded. You can query the path to see whether or not it is currently expanded, but the listener interface allows you to easily distinguish which event occurred. 17.6.6 The TreeExpansionListener Interface To catch these events yourself, you can implement the TreeExpansionListener interface, which provides the following two methods to easily separate tasks for collapsing and expanding paths: public void treeExpanded(TreeExpansionEvent e) public void treeCollapsed(TreeExpansionEvent e) Called when a path is collapsed or expanded. 17.6.7 Pending Expansion Events The JDK1.2 beta4 release introduced two new classes that help you listen and react to expansion events before they occur. The TreeWillExpandListener interface allows you to register interest in pending expansion events. Implementations of that interface throw an ExpandVetoException if they decide that the expansion or collapse should not be allowed. 17.6.7.1 The TreeWillExpandListener Interface This interface gives you access to the expansion events (both expanding and collapsing) before the event takes place in the tree itself. The only reason you would want to hear about such an event rather than listening for the real expansion event is if you want to do something with the tree before it changes. The interface provides the following two methods: one for expand events, the other for collapse events. public void treeWillExpand(TreeExpansionEvent event) throws ExpandVetoException public void treeWillCollapse(TreeExpansionEvent event) throws ExpandVetoException Implement these methods to react to pending expansion events. 17.6.7.2 The ExpandVetoException Class The most common reason for listening to pending expansion events is that you may want to stop one of those events from occurring. If the user did not have permission to expand a folder in a filesystem, for example, you could have a listener checking each expand event. If you find such a case where an expansion or collapse should not occur, your listener can throw an ExpandVetoException. Each of the listener methods mentioned above can throw this exception. The JTree setExpandedState() method catches these exceptions, and if one is thrown, the fireTreeExpanded() or fireTreeCollapsed() methods are never called. 17.6.7.3 Constructors public ExpandVetoException(TreeExpansionEvent event) public ExpandVetoException(TreeExpansionEvent event, String message) - 515 -
We recommend high quality webhost to host and run your jsp application: christian web host services.