Package javax.swing

Examples of javax.swing.JTree


      DirectoryDescriptor[] results = fileRenamer.getResult()
          .getFileSystemRoots();
      DefaultTreeModel model = new DefaultTreeModel(results,
          new DefaultFilter(true), LangageManager
              .getProperty("tagrename.sourcetree"));
      this.sourceTree = new JTree(model);
      this.sourceTree.getSelectionModel().setSelectionMode(
          TreeSelectionModel.SINGLE_TREE_SELECTION);
      this.sourceTree.setCellRenderer(new SourceTreeCellRenderer());
      fileRenamer.getConfig().addConfigurationChangeListener(model);
    }
View Full Code Here


      DirectoryDescriptor[] results = fileRenamer.getResult()
          .getFileSystemRoots();
      DefaultTreeModel model = new DefaultTreeModel(results,
          new TargetTreeFilter(fileRenamer.getConfig()),
          LangageManager.getProperty("tagrename.targettree"));
      this.targetTree = new JTree(model);
      this.targetTree.getSelectionModel().setSelectionMode(
          TreeSelectionModel.SINGLE_TREE_SELECTION);
      this.targetTree.setCellRenderer(new TargetTreeCellRenderer());
      this.fileRenamer.getConfig().addConfigurationChangeListener(model);
    }
View Full Code Here

         *            Description of the Parameter
         */
        public void mouseClicked(MouseEvent e) {
            checkPop(e);
            try {
                JTree tree = (JTree) e.getComponent();
            } catch (ClassCastException ex) {
                return;
            }

            if (e.getClickCount() >= 2) {
View Full Code Here

            BuddyStatus buddy = null;

            if (e.isPopupTrigger()) {
                try {

                    JTree tree = (JTree) e.getComponent();

                    TreePath path = tree.getPathForLocation(e.getX(), e.getY());
                    if (path == null) {
                        throw new ClassCastException();
                    }

                    tree.setSelectionPath(path);

                    AutomatedTreeNode node = (AutomatedTreeNode) path
                            .getLastPathComponent();
                    Object selectedUserObject = node.getUserObject();
                    if (selectedUserObject.getClass().equals(BuddyStatus.class)) {
View Full Code Here

                pluginsNode.add(new DefaultMutableTreeNode((String) i.next()));
            }
            root.add(pluginsNode);
        }

        tree = new JTree(root);
        tree.setRootVisible(false);
        tree.setShowsRootHandles(true);

        for (int a = 0; a < tree.getRowCount(); a++) {
            tree.expandRow(a);
View Full Code Here

         *
         * @param e
         *            Description of the Parameter
         */
        public void mouseClicked(MouseEvent e) {
            JTree tree = (JTree) e.getComponent();
            TreePath path = tree.getSelectionPath();
            DefaultMutableTreeNode node = (DefaultMutableTreeNode) path
                    .getLastPathComponent();
            String string = (String) node.getUserObject();
            if (string != null) {
                prefsDialog.switchPanel(string);
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));
   
    JPanel contactPanel = new JPanel();
View Full Code Here

     * @param e
     *            a mouse event to calculate the node to
     * @return a tree node which is mouse event on, or null if there is no node.
     */
    protected MouseListener getNode(MouseEvent e) {
        JTree tree = getTree(e);
        int x = e.getX();
        int y = e.getY();
        TreePath path = tree.getPathForLocation(x, y);
        if (path != null) {
            return (MouseListener) (path.getLastPathComponent());
        } else {
            return null;
        }
View Full Code Here

     * @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(
                TreeSelectionModel.SINGLE_TREE_SELECTION);
        HashMap lang2list = new HashMap();
        TransformTarget[] available = (TransformTarget[]) XslTransformer
                .getTransformTargets().toArray(new TransformTarget[0]);
        Arrays.sort(available, new LangTypeComp());
        for (int i = 0; i < available.length; i++) {
            String lang = available[i].getLanguage();
            ArrayList list = (ArrayList) lang2list.get(lang);
            if (list == null) {
                list = new ArrayList();
                lang2list.put(lang, list);
            }
            list.add(available[i]);
        }
        String[] languages = (String[]) lang2list.keySet().toArray(
                new String[0]);
        Arrays.sort(languages);
        TreePath tp = null;
        for (int i = 0; i < languages.length; i++) {
            DefaultMutableTreeNode langNode = new DefaultMutableTreeNode(
                    languages[i]);
            ((DefaultMutableTreeNode) result.getModel().getRoot())
                    .add(langNode);
            langNode.setAllowsChildren(true);
            TransformTarget[] targets = (TransformTarget[]) ((ArrayList) lang2list
                    .get(languages[i])).toArray(new TransformTarget[0]);
            Arrays.sort(targets);
            for (int j = 0; j < targets.length; j++) {
                DefaultMutableTreeNode tt = new DefaultMutableTreeNode(
                        targets[j]);
                langNode.add(tt);
                if (targets[j].equals(transformTask.getConfiguration()
                        .getTransformTarget())) {
                    tp = new TreePath(new Object[] {
                            result.getModel().getRoot(), langNode, tt });
                }
            }
        }
        result.setRootVisible(false);
        if (tp != null) {
            result.setSelectionPath(tp);
        } else {
            result.expandPath(new TreePath(result.getModel().getRoot()));
        }
        return result;
    }
View Full Code Here

    //File[] _roots=File.listRoots();
    //System.out.println(_roots[0].toString());
    //TagEditorFrame t = new TagEditorFrame();
    MyDefaultTree = new MyTreeModel(new MyFile(selectedRoot));
    JLabel j= new JLabel(LangageManager.getProperty("miage.diskexplorer")+selectedRoot.toString()) ;
    myTree = new JTree(MyDefaultTree);
   
     
    // Application de l'afficheur � l'arbre.
    myTree.setCellRenderer(myRenderer);
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.