Package javax.swing

Examples of javax.swing.JTree


        m_listScrollPane.setViewportView(m_table);
        File[] rootArray = File.listRoots();
        JPathTreeNode rootNode = null;
        rootNode = new JPathTreeNode("/", false, true);
        m_tree = new JTree()
        {
            @Override
            public String getToolTipText(MouseEvent ev)
            {
                TreePath treePath = getPathForLocation(ev.getX(), ev.getY());
View Full Code Here


        public DOMTreePanel(org.w3c.dom.Document document) {
            super(new GridLayout(1, 0));
            try {
                Node firstElement = getFirstElement(document);
                DefaultMutableTreeNode top = new XMLDefaultMutableTreeNode(firstElement);
                domJTree = new JTree(top);

                domJTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
                domJTree.setShowsRootHandles(true);
                JScrollPane domJScrollPane = new JScrollPane(domJTree);
                domJTree.setAutoscrolls(true);
View Full Code Here

        ROOTSAMPLE = new SampleResult();
        ROOTSAMPLE.setSampleLabel(SERVER_TITLE);
        ROOTSAMPLE.setSuccessful(true);
        ROOTNODE = new DefaultMutableTreeNode(ROOTSAMPLE);
        TREEMODEL = new DefaultTreeModel(ROOTNODE);
        SERVERTREE = new JTree(TREEMODEL);
        SERVERTREE.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
        SERVERTREE.addTreeSelectionListener(this);
        SERVERTREE.setShowsRootHandles(true);
        TREEPANE = new JScrollPane(SERVERTREE);
        TREEPANE.setPreferredSize(new Dimension(150, 200));
View Full Code Here

  public TreeViewer(){
    super(new BorderLayout());
    Mediator.setTreeViewer(this);
    root = new UPnPDeviceTreeNode("UPnP Devices");
    treeModel= new DefaultTreeModel(root);
    tree = new JTree(treeModel);
    Mediator.setUPnPDeviceTree(tree);
    tree.setCellRenderer(new TreeNodeCellRenderer() );
    tree.putClientProperty("JTree.lineStyle", "Angled");
        add(new JScrollPane(tree));
    addTreeSelectionListener();
View Full Code Here

    StringBuffer buffer = new StringBuffer();
    person.toString(buffer);
    System.out.println(buffer.toString());
   
    // display GUI
    JTree tree = new JTree(person);
    JFrame frame = new JFrame("JSON");
    frame.setSize(800, 600);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.getContentPane().setLayout(new BorderLayout());
    frame.getContentPane().add(new JScrollPane(tree), BorderLayout.CENTER);
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

    this.pt = new PoolingThread();
   
    System.setProperty("java.security.policy", "client.policy");
    top = new DefaultMutableTreeNode(NodesTree.TOP_NAME);
    dtm = new DefaultTreeModel(top);
    tree = new JTree(dtm);
    tree.setCellRenderer(new NodeCellRenderer(bc, this));
    tree.addTreeSelectionListener(this);
    tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
    javax.swing.ToolTipManager.sharedInstance().registerComponent(tree);
View Full Code Here

      }
      Component c = e.getComponent();
      if (!(c instanceof JTree)) {
        return;
      }
      JTree tree = (JTree) c;
      int x = e.getX();
      int y = e.getY();
      int row = tree.getRowForLocation(x, y);
      if (row >= 0) {
        popupMenu.show(tree, x, y);
      }
    }
View Full Code Here

   * @param c the given {@code Component}.
   * @return the {@code String} representation of the given {@code JTree}.
   */
  @Override
  protected @Nonnull String doFormat(@Nonnull Component c) {
    JTree tree = (JTree) c;
    String format = "%s[name=%s, selectionCount=%d, selectionPaths=%s, selectionMode=%s, enabled=%b, visible=%b, showing=%b";
    return String.format(format, tree.getClass().getName(), quote(tree.getName()), tree.getSelectionCount(),
        Arrays.format(selectionPaths(tree)), selectionMode(tree), tree.isEnabled(), tree.isVisible(), tree.isShowing());
  }
View Full Code Here

        @Override
        protected JTree executeInEDT() {
          if (root != null && !isNullOrEmpty(values)) {
            throw new IllegalStateException("Either set root or values, but not both");
          }
          JTree tree = null;
          if (root != null) {
            tree = new JTree(root);
          } else if (!isNullOrEmpty(values)) {
            tree = new JTree(values);
          } else {
            tree = new JTree();
          }
          tree.setName(name);
          return tree;
        }
      });
    }
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.