Abstract
This chapter is all about building and using trees to display a hierarchical relationship between elements. Trees allow you to convey a specific relationship between different pieces of information. For example, this kind of structure is great for showing something like an organizational chart. By the time you’re through with this chapter, you should not only be able to use trees in your own applications, but you will also more aware of the capabilities and limitations of this useful structure.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Notes
- 1.
- 2.
To minimize the chance of confusion, I’m going to try to be consistent and refer to Swing tree nodes as nodes, and WebSphere Application Server nodes as WebSphere nodes.
- 3.
This topic also came up in Chapter 10.
- 4.
Tree nodes can be expanded or collapsed by positioning the entry using a mouse or cursor keys and pressing Enter.
- 5.
Remember that AdminConfig is a wsadmin scripting object, and therefore is only available when wsadmin is used to execute the Jython script.
- 6.
- 7.
- 8.
- 9.
- 10.
See the section in Chapter 9 entitled “Limiting the Selectable Items.”
- 11.
- 12.
- 13.
The dataType of the value returned by the getLastSelectedPathComponent() method call is an object, so it needs to be converted to a string before this value can be used to update the JTextField value.
- 14.
This example is based on the DynamicTreeDemo from the Java Swing Tutorial, which can be found at http://docs.oracle.com/javase/tutorial/uiswing/components/tree.html#dynamic .
- 15.
- 16.
Actually, the top-left corner of the application is positioned on the center of the screen. This should be “close enough” for now.
- 17.
- 18.
- 19.
- 20.
It’s interesting to note that the specified node is expanded or collapsed as part of the normal double-click process. That’s why the tree is collapsed as part of this edit process.
- 21.
- 22.
Author information
Authors and Affiliations
Rights and permissions
Copyright information
© 2015 Robert A. Gibson
About this chapter
Cite this chapter
Gibson, R.A. (2015). Using JTree to Show the Forest: Hierarchical Relationships of Components. In: Swing for Jython. Apress, Berkeley, CA. https://doi.org/10.1007/978-1-4842-0817-5_11
Download citation
DOI: https://doi.org/10.1007/978-1-4842-0817-5_11
Published:
Publisher Name: Apress, Berkeley, CA
Print ISBN: 978-1-4842-0818-2
Online ISBN: 978-1-4842-0817-5
eBook Packages: Professional and Applied ComputingApress Access BooksProfessional and Applied Computing (R0)