Package javax.swing.tree

Examples of javax.swing.tree.TreeSelectionModel


    AnimationTreeRenderer renderer = new AnimationTreeRenderer(this);
    setCellRenderer(renderer);
    setCellEditor(new AnimationTreeEditor(this, renderer));
    setEditable(true);
    //animationTree.getModel().addTreeModelListener(this);
    TreeSelectionModel selectionModel = new AnimationTreeSelectionModel(this);
    setSelectionModel(selectionModel);
    //animationTree.addTreeSelectionListener(this);
    addTreeWillExpandListener(this);
    setTransferHandler(new AnimationTreeTransferHandler());
    setDragEnabled(true);
View Full Code Here


    if (selRow != -1) {
      TreePath[] paths = agentTree.tree.getSelectionPaths();
      current = (AgentTree.Node) selPath.getLastPathComponent();
      typeNode = current.getType();
      TreeSelectionModel model = agentTree.tree.getSelectionModel();
      if (!agentTree.tree.isRowSelected(selRow))
        model.setSelectionPath(selPath);
      else {
        model.setSelectionPaths(paths);
        //sameTypeNode(typeNode, paths, model);
      }
      return agentTree.getPopupMenu(typeNode);
    }
    else {
View Full Code Here

    if (selRow != -1) {
      TreePath[] paths = tree.getSelectionPaths();
      current = (AgentTree.Node) selPath.getLastPathComponent();
      typeNode = current.getType();
      TreeSelectionModel model = tree.getSelectionModel();
      if (!tree.isRowSelected(selRow))
        model.setSelectionPath(selPath);
      else {
        model.setSelectionPaths(paths);
        //sameTypeNode(typeNode, paths, model);
      }
      return agentTree.getPopupMenu(typeNode);
    }
    else {
View Full Code Here

    }

  private boolean setPopup(MouseEvent e){
    AgentTree.Node current;
    String typeNode;
    TreeSelectionModel model;

    int selRow = tree.getRowForLocation(e.getX(), e.getY());
    TreePath selPath = tree.getPathForLocation(e.getX(), e.getY());
    if(selRow != -1) {
      if(!tree.isRowSelected(selRow)) {
        model=tree.getSelectionModel();
        model.setSelectionPath(selPath);
      }
      current=(AgentTree.Node)selPath.getLastPathComponent();
      typeNode=current.getType();
      if(!typeNode.equals("")) {
  popup = agentTree.getPopupMenu(typeNode);
View Full Code Here

    }

  private boolean setPopup(MouseEvent e){
    AgentTree.Node current;
    String typeNode;
    TreeSelectionModel model;

    int selRow = tree.getRowForLocation(e.getX(), e.getY());
    TreePath selPath = tree.getPathForLocation(e.getX(), e.getY());
    if(selRow != -1) {
      if(!tree.isRowSelected(selRow)) {
  model=tree.getSelectionModel();
  model.setSelectionPath(selPath);
      }
      current=(AgentTree.Node)selPath.getLastPathComponent();
      typeNode=current.getType();
      if(!typeNode.equals("")) {
    popup = agentTree.getPopupMenu(typeNode);
View Full Code Here

            if (bIsUserDefined){
                oUserDefinedObject = _oUserDefinedObject;
                m_oInspectorPane.setTitle(_sTitle);
            }
            javax.swing.JScrollPane jScrollPane1 = new javax.swing.JScrollPane();
            TreeSelectionModel tsm = new DefaultTreeSelectionModel();
            tsm.setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);           
            jTree.setSelectionModel(tsm);
            jTree.setVisible(false);
            jPnlCenter.setLayout(new java.awt.BorderLayout(10, 10));
            jPnlCenter.getAccessibleContext().setAccessibleName("inspection tab view");
            insertTopPanel(jPnlCenter);
View Full Code Here

    // Set up the type tree. Use simple DefaultTreeModel.
    DefaultMutableTreeNode root = new DefaultMutableTreeNode("<html><b>No CAS!</b></html>");
    DefaultTreeModel treeModel = new DefaultTreeModel(root);
    this.typeTree = new JTree(treeModel);
    this.typeTree.addTreeSelectionListener(new TypeTreeSelectionListener());
    TreeSelectionModel treeSelectionModel = new DefaultTreeSelectionModel();
    treeSelectionModel.setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
    this.typeTree.setSelectionModel(treeSelectionModel);
    JScrollPane treePane = new JScrollPane(this.typeTree);
    contentPane.setLeftComponent(treePane);
    DefaultTreeCellRenderer cellRenderer = new DefaultTreeCellRenderer();
    cellRenderer.setLeafIcon(null);
View Full Code Here

        return new Dimension(0, 0);
      }
    };
    JPanel leftPane = new JPanel(new BorderLayout());
    final DemoTree demoTree = new DemoTree();
    TreeSelectionModel selectionModel = demoTree.getSelectionModel();
    selectionModel.setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
    selectionModel.addTreeSelectionListener(new TreeSelectionListener() {
      protected Example selectedExample;
      protected JComponent component;
      public void valueChanged(TreeSelectionEvent e) {
        TreePath selectionPath = demoTree.getSelectionPath();
        if(selectionPath == null) {
View Full Code Here

TOP

Related Classes of javax.swing.tree.TreeSelectionModel

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.