Search in sources :

Example 1 with DefaultTreeSelectionModel

use of javax.swing.tree.DefaultTreeSelectionModel in project JMRI by JMRI.

the class RosterGroupsPanel method getTree.

/**
     * Get the JTree containing the roster groups.
     *
     * @return The internal JTree
     */
public final JTree getTree() {
    if (_tree == null) {
        TreeSelectionModel sm = new DefaultTreeSelectionModel();
        DefaultTreeCellRenderer renderer = new DefaultTreeCellRenderer();
        sm.setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
        renderer.setLeafIcon(null);
        renderer.setClosedIcon(null);
        renderer.setOpenIcon(null);
        _tree = new JTree(getModel());
        _tree.setUI(new TreeUI());
        _tree.putClientProperty("JTree.lineStyle", "None");
        _tree.setRootVisible(false);
        _tree.expandRow(0);
        _tree.setSelectionModel(sm);
        _tree.setCellRenderer(renderer);
        _tree.addTreeWillExpandListener(new TreeWillExpandListener());
        _TSL = new TreeSelectionListener();
        _tree.addTreeSelectionListener(_TSL);
        _tree.setDragEnabled(true);
        _tree.setDropMode(DropMode.ON);
        _tree.setTransferHandler(new TransferHandler());
        _tree.addMouseListener(new MouseAdapter());
        setSelectionToGroup(selectedRosterGroup);
        Roster.getDefault().addPropertyChangeListener(new PropertyChangeListener());
    }
    return _tree;
}
Also used : JTree(javax.swing.JTree) DefaultTreeSelectionModel(javax.swing.tree.DefaultTreeSelectionModel) DefaultTreeCellRenderer(javax.swing.tree.DefaultTreeCellRenderer) DefaultTreeSelectionModel(javax.swing.tree.DefaultTreeSelectionModel) TreeSelectionModel(javax.swing.tree.TreeSelectionModel) BasicTreeUI(javax.swing.plaf.basic.BasicTreeUI)

Example 2 with DefaultTreeSelectionModel

use of javax.swing.tree.DefaultTreeSelectionModel in project binnavi by google.

the class CSelectionHistoryChooser method dispose.

/**
   * Frees allocated resources.
   */
public void dispose() {
    m_selectionHistory.removeHistoryListener(m_selectionHistoryListener);
    m_graph.removeListener(m_graphSelectionListener);
    m_tree.removeMouseListener(m_treeMouseListener);
    m_tree.removeTreeSelectionListener(m_treeSelectionListener);
    m_tree.setSelectionModel(new DefaultTreeSelectionModel());
}
Also used : DefaultTreeSelectionModel(javax.swing.tree.DefaultTreeSelectionModel)

Example 3 with DefaultTreeSelectionModel

use of javax.swing.tree.DefaultTreeSelectionModel in project binnavi by google.

the class CCombinedRightPanel method dispose.

/**
   * Frees allocated resources.
   */
public void dispose() {
    taggingPanel.getTree().dispose();
    taggingPanel.getTree().setSelectionModel(new DefaultTreeSelectionModel());
}
Also used : DefaultTreeSelectionModel(javax.swing.tree.DefaultTreeSelectionModel)

Aggregations

DefaultTreeSelectionModel (javax.swing.tree.DefaultTreeSelectionModel)3 JTree (javax.swing.JTree)1 BasicTreeUI (javax.swing.plaf.basic.BasicTreeUI)1 DefaultTreeCellRenderer (javax.swing.tree.DefaultTreeCellRenderer)1 TreeSelectionModel (javax.swing.tree.TreeSelectionModel)1