MCPcopy Create free account
hub / github.com/OpenSourcePhysics/osp / getDefaultTreeModel

Method getDefaultTreeModel

unused/javax/swing/JTree.java:503–528  ·  view source on GitHub ↗

Creates and returns a sample TreeModel . Used primarily for beanbuilders to show something interesting. @return the default TreeModel

()

Source from the content-addressed store, hash-verified

501 * @return the default <code>TreeModel</code>
502 */
503 protected static TreeModel getDefaultTreeModel() {
504 DefaultMutableTreeNode root = new DefaultMutableTreeNode("JTree");
505 DefaultMutableTreeNode parent;
506
507 parent = new DefaultMutableTreeNode("colors");
508 root.add(parent);
509 parent.add(new DefaultMutableTreeNode("blue"));
510 parent.add(new DefaultMutableTreeNode("violet"));
511 parent.add(new DefaultMutableTreeNode("red"));
512 parent.add(new DefaultMutableTreeNode("yellow"));
513
514 parent = new DefaultMutableTreeNode("sports");
515 root.add(parent);
516 parent.add(new DefaultMutableTreeNode("basketball"));
517 parent.add(new DefaultMutableTreeNode("soccer"));
518 parent.add(new DefaultMutableTreeNode("football"));
519 parent.add(new DefaultMutableTreeNode("hockey"));
520
521 parent = new DefaultMutableTreeNode("food");
522 root.add(parent);
523 parent.add(new DefaultMutableTreeNode("hot dogs"));
524 parent.add(new DefaultMutableTreeNode("pizza"));
525 parent.add(new DefaultMutableTreeNode("ravioli"));
526 parent.add(new DefaultMutableTreeNode("bananas"));
527 return new DefaultTreeModel(root);
528 }
529
530 /**
531 * Returns a <code>TreeModel</code> wrapping the specified object.

Callers 1

JTreeMethod · 0.95

Calls 1

addMethod · 0.45

Tested by

no test coverage detected