Package javax.swing.tree

Examples of javax.swing.tree.DefaultTreeModel


        _clipBoard=new ClipBoard();
        _undoManager = new UndoManager();
        _undoHandler = new UndoHandler(_undoManager);

        _rootNode = new RootNode(this, null, false);
        _treeModel = new DefaultTreeModel(_rootNode);
        setModel(_treeModel);
        setCellRenderer(new TreeCellRenderer());
        setRootVisible(false);
        setShowsRootHandles(true);
        _rootNode.refresh();
View Full Code Here


      JScrollPane treeScrollPane;
      {
        tree = new JTree();
        {
          tree.setModel(new DefaultTreeModel(null));
          tree.getSelectionModel().setSelectionMode(
            TreeSelectionModel.SINGLE_TREE_SELECTION
            );
          tree.addTreeSelectionListener(
            new TreeSelectionListener()
View Full Code Here

     */
    public int getSelectedIndex() {
        TreePath path = tree.getSelectionPath();
        DefaultMutableTreeNode node = (DefaultMutableTreeNode) path
                .getLastPathComponent();
        DefaultTreeModel model = (DefaultTreeModel) tree.getModel();
        return model.getIndexOfChild(root, node);
    }
View Full Code Here

     * Gets the number of rows
     *
     * @return the row count
     */
    public int getRowCount() {
        DefaultTreeModel model = (DefaultTreeModel) tree.getModel();
        return model.getChildCount(root);
    }
View Full Code Here

  {
    horizontalSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
    horizontalSplitPane.setBorder(GUIHelper.createEmptyBorder(5));
   
    rootNode = new DefaultMutableTreeNode();
    addressBookTreeModel = new DefaultTreeModel(rootNode);
    addressBookTree = new JTree(addressBookTreeModel);
    addressBookTree.setRootVisible(false);
    addressBookTree.setCellRenderer(new ContactCollectionCellRenderer());
    horizontalSplitPane.add(new JScrollPane(addressBookTree));
   
View Full Code Here

        main.add(helpButton);
        // header.setBorder(BorderFactory.createMatteBorder(1,1,1,1,Color.red));
        // helpButton.setBorder(BorderFactory.createMatteBorder(1,1,1,1,Color.red));
        groupsTree = new GroupsTree(this);
        groupsTree.addTreeSelectionListener(this);
        groupsTree.setModel(groupsTreeModel = new DefaultTreeModel(groupsRoot));
        sp = new JScrollPane(groupsTree,
                JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
                JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
        revalidateGroups();
        con.gridwidth = GridBagConstraints.REMAINDER;
View Full Code Here

        }
        frame.groupToggle.setSelected(false);
    }

    public void setGroups(GroupTreeNode groupsRoot) {
        groupsTree.setModel(groupsTreeModel = new DefaultTreeModel(groupsRoot));
        this.groupsRoot = groupsRoot;
        if (Globals.prefs.getBoolean("groupExpandTree"))
                groupsTree.expandSubtree(groupsRoot);
    }
View Full Code Here

     * Creates the tree for selection the tranformation and inserts all choices.
     *
     * @return tree for selection the transformation target.
     */
    private JTree createTree() {
        DefaultTreeModel treeModel = new DefaultTreeModel(
                new DefaultMutableTreeNode("root"));
        JTree result = new JTree(treeModel);
        result.addTreeSelectionListener(this);
        result.setCellRenderer(new TreeRenderer());
        result.getSelectionModel().setSelectionMode(
View Full Code Here

        appli = parent;

        // tree section.
        rootNode = new DefaultMutableTreeNode("Options");
        treeModel = new DefaultTreeModel(rootNode);
        treeSections = new JTree(treeModel);
        treeSections.setEditable(false);
        treeSections.setBackground(new Color(1.0f, 1.0f, 1.0f));
        treeSections.setShowsRootHandles(true);
        treeSections.setRowHeight(20);
View Full Code Here

        for (Category category : categories) {
          DefaultMutableTreeNode categoryNode = new DefaultMutableTreeNode(category);
          rootNode.add(categoryNode);
        }

        TreeModel treeModel = new DefaultTreeModel(rootNode);
        _categoryTree.setModel(treeModel);
      }
    }.start();
  }
View Full Code Here

TOP

Related Classes of javax.swing.tree.DefaultTreeModel

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.