What is .useful?
.useful is a functional and easy-to-use library of Java classes. Our goal is to increase the developer's productivity. .useful strongly follows object-oriented concepts so you can use it for educational purposes as a sample of good object-oriented design.
Swing Tree classes extension
org.dotuseful.ui.tree.AutomatedTreeModel and org.dotuseful.ui.tree.AutomatedTreeNode allows you to manage tree node contents from the node itself. With standard Swing DefaultTreeModel and DefaultMutableTreeNode, you are forced to manipulate your nodes using calls to TreeModel. You add your node's children using a call to DefaultTreeModel.insertNodeInto(childNode, parent, position), you need to message DefaultTreeModel.nodeChanged(node) after your node has been changed.
With .useful you could change node's children and a node itself and forget about TreeModel - it gets notified automatically. You have ability to make your node responsible for its contents - it really could make your code more clear. And there is no need to keep a reference to TreeModel resulting in less copulation of your classes.
org.dotuseful.ui.tree.SortedTreeNode is an example of AutomatedTreeNode in use and presents you a node which keeps its children sorted.
org.dotuseful.ui.tree.MouseAdaptedTree is a tree which transmits mouse events to its nodes. You could invoke popup menu and other custom actions then.
Array Search
org.dotuseful.util.ArrayMgr provides methods for search for array within an array.
Have thoughts? We want to hear from you! Contact us on our forums.