Package javax.swing

Examples of javax.swing.JTree


    updateObjectNames();

    // create the tree, and find the path to the current class
    m_treeNodeOfCurrentObject = null;
    final JTree tree = createTree(m_ObjectNames);
    if (m_treeNodeOfCurrentObject != null) {
      tree.setSelectionPath(new TreePath(m_treeNodeOfCurrentObject.getPath()));
    }
    tree.getSelectionModel().setSelectionMode
      (TreeSelectionModel.SINGLE_TREE_SELECTION);

    // create the popup
    final JPopupMenu popup = new JTreePopupMenu(tree);

    // respond when the user chooses a class
    tree.addTreeSelectionListener(new TreeSelectionListener() {
  public void valueChanged(TreeSelectionEvent e) {
    GOETreeNode node = (GOETreeNode) tree.getLastSelectedPathComponent();
   
    if (node == null)
      return;
   
    if (node.isLeaf()) {
      classSelected(getClassnameFromPath(tree.getSelectionPath()));
      popup.setVisible(false);
    }
  }
      });
   
View Full Code Here


        superRoot = root;
      else
        superRoot.add(root);
    }
   
    JTree tree = new JTree(superRoot);
   
    return tree;
  }
View Full Code Here

      add(toolBarPanel, BorderLayout.NORTH);

      DefaultTreeModel model = new DefaultTreeModel(jtreeRoot);

      // subclass JTree so that tool tips can be displayed for leaves (if necessary)
      m_componentTree = new JTree(model) {
        public String getToolTipText(MouseEvent e) {
          if ((getRowForLocation(e.getX(), e.getY())) == -1) {
            return null;
          }
          TreePath currPath = getPathForLocation(e.getX(), e.getY());
View Full Code Here

    treeModel = new ConfigTreeModel(packageManager, includeGlobals);

    final TreeSelectionModel selectionModel = new DefaultTreeSelectionModel();
    selectionModel.setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);

    tree = new JTree(treeModel);
    tree.setSelectionModel(selectionModel);
    tree.setCellRenderer(new ConfigTreeRenderer());
    tree.setRootVisible(false);
    tree.setShowsRootHandles(true);
    tree.addTreeSelectionListener(new ModuleTreeSelectionHandler());
View Full Code Here

  }

  public Tree(Widget parent, String name) throws GUIException {
    super(parent, name);

    tree = new JTree(rootNode);
    tree.addTreeSelectionListener(new TreeSelectionListener() {
      public void valueChanged(TreeSelectionEvent e) {
        if (sendEvents) {
          try {
            sendEvents = false;
View Full Code Here

    public void init(DefaultMutableTreeNode top) {

        layerFeatures = new Hashtable();

        // Create a tree that allows one selection at a time.
        final JTree tree = new JTree(top);
        tree.getSelectionModel()
                .setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
        tree.setVisibleRowCount(10);

        // Listen for when the selection changes.
        tree.addTreeSelectionListener(new TreeSelectionListener() {
            public void valueChanged(TreeSelectionEvent e) {
                DefaultMutableTreeNode node = (DefaultMutableTreeNode) tree.getLastSelectedPathComponent();

                if (node == null)
                    return;

                Object nodeInfo = node.getUserObject();
                if (node.isLeaf() && nodeInfo instanceof FeatureInfo) {
                    currentFeature = node;
                    // enable addToLayer button here.
                    addFeatureButton.setEnabled(true);
                } else {
                    // disable addToLayer button here.
                    addFeatureButton.setEnabled(false);
                }
            }
        });

        if (playWithLineStyle) {
            tree.putClientProperty("JTree.lineStyle", lineStyle);
        }

        // Create the scroll pane and add the tree to it.
        GridBagLayout outergridbag = new GridBagLayout();
        GridBagConstraints outerc = new GridBagConstraints();
View Full Code Here

    rootContent.add(placeHolder, BorderLayout.NORTH);

    final DemoSelectorTreeNode root = new DemoSelectorTreeNode(null,
        demoSelector);
    final DefaultTreeModel model = new DefaultTreeModel(root);
    final JTree demoTree = new JTree(model);
    demoTree.addTreeSelectionListener(new TreeSelectionHandler());

    JSplitPane rootSplitPane =
        new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,
            new JScrollPane(demoTree), rootContent);
    rootSplitPane.setContinuousLayout(true);
View Full Code Here

    private void createTreePanel() {
        rootNode = new TaskTreeBaseNode();

        model = new DefaultTreeModel(rootNode);
        tree = new JTree(model);

        tree.setRootVisible(false);
        tree.setShowsRootHandles(true);

        renderer = new Renderer();
View Full Code Here

        // Create help tree
        rootNode = new HelpNode();

        rootTreeNode = new DefaultMutableTreeNode();
        DefaultTreeModel treeModel = new DefaultTreeModel(rootTreeNode);
        helpTree = new JTree();
        helpTree.setModel(treeModel);
        helpTree.setRootVisible(false);
        helpTree.setShowsRootHandles(true);
        helpTree.addTreeSelectionListener(this);

        // Renderer
        DefaultTreeCellRenderer  helpTreeRenderer = (DefaultTreeCellRenderer) helpTree.getCellRenderer();
        helpTreeRenderer.setOpenIcon(resources.getIcon("folderIcon"));
        helpTreeRenderer.setClosedIcon(resources.getIcon("folderIcon"));
        helpTreeRenderer.setLeafIcon(resources.getIcon("leafIcon"));

        createHelpContents();


        // Create help search panel

        // search tree
        searchRootTreeNode = new DefaultMutableTreeNode();
        searchTreeModel = new DefaultTreeModel(searchRootTreeNode);
        searchTree = new JTree();
        searchTree.setModel(searchTreeModel);
        searchTree.setRootVisible(false);
        searchTree.setShowsRootHandles(true);
        searchTree.addTreeSelectionListener(this);
View Full Code Here

    {
      Dimension minimumSize = new Dimension(200, 100);

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

TOP

Related Classes of javax.swing.JTree

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.