Package javax.swing.tree

Examples of javax.swing.tree.DefaultMutableTreeNode


      for(int i=0;i<children.length;i++){
        if(children[i].isDirectory() && !children[i].isHidden()){
      //    DefaultMutableTreeNode test = new DefaultMutableTreeNode(new MyFile(children[i].getAbsolutePath()));
     
          //On insert de nouveaux neux dans le treeModel
          treeModel.insertNodeInto(new DefaultMutableTreeNode(new MyFile(children[i].getAbsolutePath())),parentNode,x);
          /*MyFile est une classe qui h�rite de File
           * new MyFile(children[i].getAbsolutePath())) on cr�e un Fichier avec le chemin complet des fichiers qui on �t� list�.
           * Et gr�ce a ce chemin complet on va pouvoir cr�er un DefaultMutableTreeNode
           *         
           */
 
View Full Code Here


    /* (non-Javadoc)
     * @see javax.swing.event.TreeSelectionListener#valueChanged(javax.swing.event.TreeSelectionEvent)
     */
    public void valueChanged(TreeSelectionEvent arg0) {
     
      DefaultMutableTreeNode f = (DefaultMutableTreeNode) arg0.getPath().getLastPathComponent();
      File ff = (File) f.getUserObject();

      /*MainWindow mainWindow = (MainWindow) javax.swing.SwingUtilities.windowForComponent((Component)arg0.getSource());*/
     
      if(!ff.isDirectory()){
        //action si ca n'est pas un r�pertoire
View Full Code Here

    /* (non-Javadoc)
     * @see javax.swing.event.TreeSelectionListener#valueChanged(javax.swing.event.TreeSelectionEvent)
     */
    public void valueChanged(TreeSelectionEvent arg0) {
     
      DefaultMutableTreeNode f = (DefaultMutableTreeNode) arg0.getPath().getLastPathComponent();
      File ff = (File) f.getUserObject();

      /*MainWindow mainWindow = (MainWindow) javax.swing.SwingUtilities.windowForComponent((Component)arg0.getSource());*/
     
      if(!ff.isDirectory()){
        //action si ca n'est pas un r�pertoire
View Full Code Here

    public Component getTreeCellRendererComponent(
            JTree tree, Object value, boolean sel, boolean expanded, boolean leaf,
            int row, boolean hasFocus) {

      super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
    DefaultMutableTreeNode Df = (DefaultMutableTreeNode) value;
    String nom = ((File)Df.getUserObject()).getAbsolutePath();
      if (AL.contains(nom))
      {
        ImageIcon icon = ResourcesRepository.getImageIcon("index.gif");
        setIcon(icon);
      }
View Full Code Here

     * (non-Javadoc)
     *
     * @see javax.swing.event.TreeSelectionListener#valueChanged(javax.swing.event.TreeSelectionEvent)
     */
    public void valueChanged(TreeSelectionEvent e) {
        DefaultMutableTreeNode node = (DefaultMutableTreeNode) (e.getPath()
                .getLastPathComponent());
        String sNode = (String) (node.getUserObject());

        // - ask the settingPanel if parameters are changed
        // boolean bHasChange = settingPanel.applyChanges(true); //no change to
        // do on this panel

View Full Code Here

        List preorderedNodes = Collections.list(((DefaultMutableTreeNode) jtree
                .getModel().getRoot()).preorderEnumeration());
        List result = new ArrayList();
        int currentHeight = 0;
        for (int i = 1; i < preorderedNodes.size(); i++) {
            DefaultMutableTreeNode nextNode = (DefaultMutableTreeNode) preorderedNodes
                    .get(i);
            if (false==nextNode.getUserObject() instanceof Task) {
                continue;
            }
            if ((currentHeight+nodeHeight) > minHeight
                    && jtree.isVisible(new TreePath(nextNode.getPath()))) {
                result.add(nextNode.getUserObject());
            }
            if (jtree.isVisible(new TreePath(nextNode.getPath()))) {
                currentHeight += nodeHeight;
            }
            if(currentHeight > minHeight + maxHeight) {
                break;
            }
View Full Code Here

        super(parent, GanttProject.correctLabel(title), modal);

        appli = parent;

        // tree section.
        rootNode = new DefaultMutableTreeNode("Options");
        treeModel = new DefaultTreeModel(rootNode);
        treeSections = new JTree(treeModel);
        treeSections.setEditable(false);
        treeSections.setBackground(new Color(1.0f, 1.0f, 1.0f));
        treeSections.setShowsRootHandles(true);
View Full Code Here

    public abstract void constructSections();

    /** Add a sub section. */
    public DefaultMutableTreeNode addObject(Object child,
            DefaultMutableTreeNode parent) {
        DefaultMutableTreeNode childNode = new DefaultMutableTreeNode(child);
        if (parent == null)
            parent = rootNode;
        treeModel.insertNodeInto(childNode, parent, parent.getChildCount());
        treeSections.scrollPathToVisible(new TreePath(childNode.getPath()));
        return childNode;
    }
View Full Code Here

        cancelButton.hide();
    }

    /** Callback for the tree selection event. */
    public void valueChanged(TreeSelectionEvent e) {
        DefaultMutableTreeNode node = (DefaultMutableTreeNode) (e.getPath()
                .getLastPathComponent());
        String sNode = (String) (node.getUserObject());

        // - ask the settingPanel if parameters are changed
        // boolean bHasChange = settingPanel.applyChanges(true); //no change to
        // do on this panel

View Full Code Here

        mainPanel2.validate(); // valide the changes
    }

    /** Coonstruct the menu settings. */
    public void constructSections() {
        DefaultMutableTreeNode aboutNode = addObject(GanttProject
                .correctLabel(language.getText("about")), null);
        DefaultMutableTreeNode authorsNode = addObject(language
                .getText("authors"), null);
        DefaultMutableTreeNode jinfosNode = addObject(language
                .getText("jinfos"), null);
        DefaultMutableTreeNode licenseNode = addObject(language
                .getText("license"), null);
        DefaultMutableTreeNode libraryNode = addObject(language
                .getText("library"), null);
    }
View Full Code Here

TOP

Related Classes of javax.swing.tree.DefaultMutableTreeNode

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.