Web server - Java Swing O Reilly Similar to other exception

Java Swing O Reilly Similar to other exception classes, these constructors build new exceptions with the proposed expansion event, and an optional message. 17.6.7.4 Fields protected TreeExpansionEvent event While the ExpandVetoException class does not provide any public read access to the event used in constructing the exception, that event is stored in this protected field for use by subclasses. 17.6.8 Implementing the Expansion Listener Interface If you look back at our expression tree, you’ll notice that the nodes are never told that they have been expanded or collapsed. That has the side effect of leaving the entire expression represented below a given operator as the displayed string. Without listening to any of these events, a completely expanded expression tree might look like Figure 17.9. We would like an expanded branch to show only the operator associated with that branch, as in Figure 17.9. Figure 17.9. Expression tree with static labels for the operator nodes 17.10. Expression tree with “dynamic” operator labels updated by expansion events We can accomplish that by implementing the TreeExpansionListener interface and adding the following bits of code to the ExprTree class. public void treeExpanded(TreeExpansionEvent tee) { OpNode node = (OpNode)te.getPath().getLastPathComponent(); node.setExpanded(true); treeModel.refresh(tee); } public void treeCollapsed(TreeExpansionEvent tee) { OpNode node = (OpNode)te.getPath().getLastPathComponent(); node.setExpanded(false); treeModel.refresh(tee); - 516 -
We would like to recommend you tested and proved virtual web hosting services, which you will surely find to be of great quality.

Leave a Reply