JTREE -  DefaultMutableTreeNode

How to cast from DefaultMutableTreeNode to INTEGER?
I set :
DefaultMutableTreeNode node = new DefaultMutableTreeNode(rs.getInt("task_id"));then in the renderer I want to take this id as INTEGER, but I get error:
java.lang.ClassCastException: javax.swing.tree.DefaultMutableTreeNode
this line in the renderer with error:
Integer id = (Integer) value;

Where? In the renderer??
I want to add in the renderer enother text (to the JLable) where is the id value.
Do you have an example?
Thanks :)

Similar Messages

  • JTree DefaultMutableTreeNode Coloring

    hi
    i am facing a problem.I want to create root node with different color anf font and its child node with different color and font.When I change the color of my tree the whole tree nodes are given the same color.Is there any way in which i can color different nodes in the tree with different colors and font?

    hello here is some comdesnippet howto create you're own
    class MyRenderer extends JLabel implements TreeCellRenderer
    ImageIcon rootIcon ;
    ImageIcon dirIcon;
    Font font10 = new Font("Helvetica", Font.PLAIN ,10);
    public MyRenderer(ResourceBundle i)
    rootIcon = new ImageIcon(images.getString("EXPLORER"));
    dirIcon = new ImageIcon(images.getString("PROJECT16"));
    setOpaque(false);
    setBackground(null);
    public Component getTreeCellRendererComponent(JTree tree,
    Object value,
    boolean sel,
    boolean expanded,
    boolean leaf,
    int row,
    boolean hasFocus)
    // setFont(tree.getFont());
    setEnabled(tree.isEnabled());
    if( isEnabled(value))
    if (sel){
    // this.setForeground(new Color(57,90,70));
    this.setForeground(new Color(255,0,0));
    this.setBackground(new Color(255,2,0));
    else
    this.setForeground(new java.awt.Color(16, 49, 74));
    else
    this.setForeground(Color.red);
    setFont(font10);
    setText(tree.convertValueToText(value, sel, expanded, leaf, row, hasFocus));
    if (value != null)
    if (leaf)
    greetings Sven

  • Any component as leaf for JTree problems

    hi,
    I'm trying to get arbitary components as leaves in a JTree and it looks like its very nearly there, but there are two (related?) problems.
    1) If you click around on the top 3 tree components then it gets stuck in a loop of rendering and causes a stack exception to be thrown.
    2) For the embedded JTree component, expanding its nodes doesn't update the parent tree
    both may be because current the row height is set at the wrong time (in the TreeCellRenderer)
    any help would be really appreciated!
    thanks,
    asjf
    import javax.swing.*;
    import javax.swing.tree.*;
    import java.awt.*;
    import java.util.*;
    public class ComponentTree
         public static void main(String args[])
              try{(new UIManager()).setLookAndFeel((new UIManager()).getSystemLookAndFeelClassName());}
              catch(Exception e){}
              DefaultMutableTreeNode c0 = new DefaultMutableTreeNode(new JButton("root"));
              DefaultMutableTreeNode c1 = new DefaultMutableTreeNode(new JButton("c1"));
              DefaultMutableTreeNode c2 = new DefaultMutableTreeNode(new JList(new Object [] {"A","B","C"}));
              DefaultMutableTreeNode c3 = new DefaultMutableTreeNode(new JTable(new Object [][] {{"Active","true"},{"User","root"}}, new Object [] {"Name","Value"}));
              DefaultMutableTreeNode c4 = new DefaultMutableTreeNode(new JTree());
              DefaultMutableTreeNode c5 = new DefaultMutableTreeNode(new JList(new Object [] {"D","E","F"}));
              DefaultMutableTreeNode c6 = new DefaultMutableTreeNode(new JCheckBox("Active",true));
              DefaultTreeModel dtm = new DefaultTreeModel(c0);
                   dtm.insertNodeInto(c6,c0,0);
                   dtm.insertNodeInto(c1,c0,0);
                   dtm.insertNodeInto(c2,c0,0);
                   dtm.insertNodeInto(c5,c2,0);
                   dtm.insertNodeInto(c3,c1,0);
                   dtm.insertNodeInto(c4,c3,0);
              JTree tree = new JTree(dtm);
                   tree.setEditable(true);
                   tree.setCellRenderer(new DefaultTreeCellRenderer()
                        public Component getTreeCellRendererComponent(     JTree tree,     Object value, boolean isSelected, boolean expanded, boolean leaf, int row, boolean hasFocus)
                             System.out.println("Render row "+row);
                             Component c = (Component) ((DefaultMutableTreeNode) value).getUserObject();
                             if(c instanceof JCheckBox)
                                  c.setBackground(UIManager.getColor("Tree.textBackground"));
                             tree.setRowHeight(c.getHeight());                    
                             return c;     
                   tree.setCellEditor(new DefaultTreeCellEditor(tree,(DefaultTreeCellRenderer)tree.getCellRenderer())
                        public boolean isCellEditable(EventObject evt){return true;}
                        public Component getTreeCellEditorComponent(     JTree tree,     Object value, boolean isSelected, boolean expanded, boolean leaf, int row)
                             return (Component) ((DefaultMutableTreeNode) value).getUserObject();
              JFrame frame = new JFrame("ComponentTree");
                   frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                   frame.getContentPane().add(tree);     
                   frame.pack();
                   frame.show();
    }

    thanks!
    this seems an awful lot of code to get this working - it should be possible to have a single CellEditor/Renderer??
    also running the code - its very hard to select checkbox items, and the JLists seem to disable themselves when the main tree updates?
    its also not general to any Component (?) (although we probably only want JComponent) so we can't add a JTree as a leaf?
    I'm guessing there is a simpler way to get this working?

  • How remove (or change) children inside a JTree

    hi,
    I did a program where there are informations with a structure of dependence that should be showed inside JTree components.
    I realized this purpose in my program .
    But I am findind very difficult (after having put the information inside the JTre in the start) to show them again inside the JTrees when they are changed.
    I don't know how to remove or change the informations after they are put on the children of the JTree using the methods that I found in the documentation to reach this purpose...
    I need some help ...
    To explain well my problem, and facilitate the helpers, I post some code that show my problem..
    The program show a GUI with some JTrees.
    The informations are contained in two strings, and in the GUI are also two buttons that can load the informations inside the JTree when they are clicked.
    Thank you in advance
    regards
    tonyMrsangelo
    public class JTree_TryToUseIt_ChangingNodes extends javax.swing.JFrame {
        private PanelFulViewConteiner jPanelFulViewConteiner;
        Dimension dimPrefArcPanels = new Dimension(910, 150);
        Dimension dimMinArcPanels = new Dimension(700, 100);
        Dimension dimPrefSemiArcPanels = new Dimension(850, 140);
        Dimension dimMinSemiArcPanels = new Dimension(550, 90);
        Dimension dimPrefBodyXpicPanels = new Dimension(900, 150);
        Dimension dimMinBodyXpicPanels = new Dimension(700, 150);
        Dimension treePrefDim = new Dimension(90, 110); //
        Dimension treeMinDim = new Dimension(60, 110);
        PanelToShowTrees panel_trees;
        public JTree_TryToUseIt_ChangingNodes() {
            getContentPane().setLayout(new GridBagLayout());
            GridBagConstraints gBC = new GridBagConstraints();
            jPanelFulViewConteiner = new PanelFulViewConteiner();
            gBC.gridx = 0;
            gBC.gridy = 0;
            gBC.gridwidth = 10;
            add(jPanelFulViewConteiner, new GridBagConstraints());
            gBC.gridx = 0;
            gBC.gridy = 1;
            gBC.gridwidth = 10;
            pack();
            panel_trees = this.jPanelFulViewConteiner.jPanelFulContainerTop.panelToShowTrees;
            setDefaultCloseOperation(EXIT_ON_CLOSE);
            setLocation(50, 50);
            setVisible(true);
        private void fillTrees(String[] strings) {
            collapseTrees();
            removeNodes();
            for (int index = 0; index < strings.length; index++) {
                DefaultMutableTreeNode dmt = new DefaultMutableTreeNode(strings[index]);
                String knotStr = strings[index].substring(0, 1);
                int knot = -1;
                try {
                    knot = Integer.parseInt(knotStr);
                } catch (NumberFormatException e) {
                panel_trees.root_Node[knot].add(dmt);
                panel_trees.validate();
                panel_trees.repaint();
            collapseTrees();
        void collapseTrees() {
            for (int i = 0; i < 8; i++) {
                panel_trees.jTree.collapseRow(0);
    panel_trees.jTree[i].expandRow(0);
    panel_trees.validate();
    panel_trees.repaint();
    void removeNodes() {
    for (int i = 0; i < 8; i++) {
    panel_trees.jTree[i].removeAll();
    panel_trees.validate();
    panel_trees.repaint();
    public static void main(String args[]) {
    JTree_TryToUseIt_ChangingNodes xx = new JTree_TryToUseIt_ChangingNodes();
    class PanelFulViewConteiner extends JPanel {
    PanelFulContainerTop jPanelFulContainerTop;
    PanelFulContainerBottom jPanelFulContainerBottom;
    public PanelFulViewConteiner() {
    GridBagLayout gbl = new GridBagLayout();
    this.setLayout(gbl);
    GridBagConstraints gBC = new GridBagConstraints();
    jPanelFulContainerTop = new PanelFulContainerTop();
    gBC.gridx = 0;
    gBC.gridy = 0;
    add(jPanelFulContainerTop, gBC);
    jPanelFulContainerBottom = new PanelFulContainerBottom();
    gBC.gridx = 0;
    gBC.gridy = 2;
    add(jPanelFulContainerBottom, gBC);
    class PanelFulContainerTop extends JPanel {
    PanelToShowTrees panelToShowTrees;
    public PanelFulContainerTop() { // costruttore
    this.setMinimumSize(dimMinArcPanels);
    this.setPreferredSize(dimPrefArcPanels);
    setLayout(new FlowLayout());
    panelToShowTrees = new PanelToShowTrees();
    add(panelToShowTrees);
    }// costruttore
    class PanelFulContainerBottom extends JPanel {
    JButton but1 = new JButton("load string1");
    JButton but2 = new JButton("load string2");
    String[] str1 = {"0-AAA", "0-BBBBBB", "2-CCCCC", "2-DDDDDD", "2-EEEEEEE", "5-FFFFFF", "5-GGGGGG", "5-HHHHHH", "7-IIIIII", "7-KKKKKKK", "7-LLLLLL", "7-MMMMMM"};
    String[] str2 = {"0-aaaaa", "0-bbbbb", "0-cccc", "2-ddddd", "2-eeee", "3-ffffff", "3-gggggg", "3-hhhhh", "4-iiiiii", "4-kkkkk", "7-lllllll", "7-mmmmm", "7-nnnnn"};
    public PanelFulContainerBottom() {// costruttore
    this.setMinimumSize(dimMinArcPanels);
    this.setPreferredSize(dimPrefArcPanels);
    add(but1);
    but1.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
    fillTrees(str1);
    add(but2);
    but2.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
    fillTrees(str2);
    class PanelToShowTrees extends JPanel {
    JScrollPane jScrollPane[];
    JTree jTree[];
    DefaultMutableTreeNode[] root_Node;
    public PanelToShowTrees() {
    this.setMinimumSize(dimMinSemiArcPanels);
    this.setPreferredSize(dimPrefSemiArcPanels);
    setLayout(new FlowLayout());
    jScrollPane = new JScrollPane[8];
    jTree = new JTree[8];
    root_Node = new DefaultMutableTreeNode[8];
    for (int i = 0; i < 8; i++) {
    root_Node[i] = new DefaultMutableTreeNode(" " + (8 - i));
    jTree[i] = new JTree(root_Node[i]);
    jScrollPane[i] = new JScrollPane();
    jScrollPane[i].setViewportView(jTree[i]);
    add(jScrollPane[i]);
    jScrollPane[i].setPreferredSize(treePrefDim);
    jScrollPane[i].setMinimumSize(treeMinDim);
    jTree[i].addTreeSelectionListener(new TreeSelectionListener() {
    public void valueChanged(TreeSelectionEvent e) {
    showContentOfTheTree(e);
    private void showContentOfTheTree(TreeSelectionEvent e) {
    String stringaGotFromEvent = e.getPath().toString();
    JOptionPane.showMessageDialog(rootPane, "found =---> " + stringaGotFromEvent);

    hi Andre,
    thank you for answering me.
    I have not much practice with JTrees so I find some difficulty to use it...
    After I got your advice, I made changed a little the design of my program..
    This it is a program for management of a dentist office, and I would show in 8 JTrees (every jTree root represents the teeth in a dental arch) the treatments that each tooth got.
    How I said, the 8 JTree roots are representing the teeth, and in this architecture the problem is:
    - to add a node to a tree root to indicate a treatment for that tooth;
    - to delete all the children from a jTree root before beginning to add new child, before writing again treatments, when the informations are changed.
    Following your help, I made this two functions to reach this purpose:
    private void assingTreatmentToTooth(int toothNmbr, String strTreatment) {
            DefaultMutableTreeNode newChild = new DefaultMutableTreeNode(strTreatment); // new treatment to add
            DefaultTreeModel model = (DefaultTreeModel) panel_trees.jTreeXdentalRoots[toothNmbr].getModel(); // get model for the root Tree
            DefaultMutableTreeNode parentNode = (DefaultMutableTreeNode) model.getRoot();
            model.insertNodeInto(newChild, parentNode, 0); // always assign 0 as first node
        } // assingTreatmentToTooth()
    private void removeTreatmentFromAtooth(int toothNmbr, int childNmbr) {
            DefaultTreeModel model = (DefaultTreeModel) panel_trees.jTreeXdentalRoots[toothNmbr].getModel();  // get model for the root Tree
            DefaultMutableTreeNode child = (DefaultMutableTreeNode) model.getChild(model, childNmbr);
            model.removeNodeFromParent(child);
        } // removeTreatmentToTooth()when the second function is executed, I get this error:
    Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: javax.swing.tree.DefaultTreeModel cannot be cast to javax.swing.tree.TreeNode
    at the line : DefaultMutableTreeNode child = (DefaultMutableTreeNode) model.getChild(model, childNmbr);
    DefaultMutableTreeNode child = (DefaultMutableTreeNode) model.getChild(model, childNmbr);
    could you tell me what is wrong ?
    regards
    TonyMrsangelo

  • Refresh JTrees

    Hi guys,
    I am currently working a project which required me to implement three different hierarchy structure and use combobox to choose between them. I am able to construct three trees and able to display individual correctly. But I have difficulty to refresh the hierachy tree by choose another combobox choice. I would be appreciated if some one can give me a simple examples to show how do I do it.
    i.e. I had three combobox color, sport and food. also three corresponding hierachy, at each time only one hierarchy can be displayed by choosing one of the combobox.
    Thanks very much

    /* declaration of JTree */
    DefaultMutableTreeNode myTreeTopNode = new DefaultMutableTreeNode("Root");
    DefaultTreeModel myTreeModel = new DefaultTreeModel(myTreeTopNode);
    JTree myTree = new JTree(myTreeModel);
    //do your change on tree
    /* reload the tree */
    myTreeModel.reload();Bye
    Monica

  • JTree cut and paste multiple child and ancestor nodes not function correct

    Hello i'm creating a filebrowser for multimedia files (SDK 1.22) such as .jpg .gif .au .wav. (using Swing, JTree, DefaultMutableTreeNode)
    The problem is I want to cut and paste single and multiple nodes (from current node til the last child "top-down") which partly functions:
    single nodes and multiple nodes with only one folder per hierarchy level;
    Not function:
    - multiple folders in the same level -> the former order gets lost
    - if there is a file (MMed. document) between folders (or after them) in the same level this file is put inside one of those
    I tried much easier functions to cope with this problem but every time I solve one the "steps" the next problem appears...
    The thing I don't want to do, is something like a LinkedList, Hashtable (to store the nodes)... because the MMed. filebrowser would need to much resources while browsing through a media library with (e.g.) thousands of files!
    If someone has any idea to solve this problem I would be very pleased!
    Thank you anyway by reading this ;)
    // part of the code, if you want more detailed info
    // @mail: [email protected]
    import java.util.Enumeration;
    import javax.swing.*;
    import javax.swing.tree.*;
    // var declaration
    static Enumeration en;
    static DefaultMutableTreeNode jTreeModel, lastCopiedNode, dmt, insert, insertParent, insertSameFolder;
    static String varCut;
    static int index= 0;
    static int counter = 0;
    /* cut function */
    if (actionCommand.equals ("cut"))
         // get the selected node (DefaultMutableTreeNode)
         lastCopiedNode = (DefaultMutableTreeNode)  selPath.getLastPathComponent ();
         // get the nodes in an Enumeration array (in top- down order)
         en = dmt.preorderEnumeration();
         // the way to make sure if it is a cut or a copied node
         varCut = "cut";
    /* paste function */
    if (actionCommand.equals ("paste"))
    // node is cut
    if (varCut == "cut")
    // is necessary for first time same folder case
    insertParent = dmt;
    // getting the nodes out of the array
    while(en.hasMoreElements())
         // cast the Object to DefaultMutableTreeNode
         // and get stored (next) node
         insert = (DefaultMutableTreeNode) en.nextElement();
    // check if the node is a catalogue when getRepresentation()
    // is a function of my node creating class (to know if it is
    // a folder or a file)
    if (insert.getRepresentation().equals("catalogue"))
         // check if a "folder" node is inserted
         if (index == 1)
              counter = 0;
              index = 0;
         System.out.println ("***index and counter reset***");
         // the node is in the same folder
         // check if the folder is in the same hierarchy level
         // -> in this case the insertParent has to remain
         if (insert.getLevel() == insertParent.getLevel())
              // this is necessary to get right parent folder
              insertSameFolder = (Knoten) insert.getParent();
              jTreeModel.insertNodeInto (insert, insertSameFolder, index);
    System.out.println (">>>sameFolderCASE- insert"+counter+"> " + String.valueOf(insert) +
              "\ninsertTest -> " + String.valueOf(insertTest)
              // set insertParent folder to the new createded one
              insertParent = insert;
              index ++;
         else // the node is a subfolder
              // insertNode
              jTreeModel.insertNodeInto (insert, insertParent, index);
              // set insertParent folder to the new createded one
              insertParent = insert;
    System.out.println (">>>subFolderCASE- insertParent"+counter+"> " + String.valueOf(insertParent) +
              "\ninsertParent -> " + String.valueOf(insertParent)
              index ++;
    else // the node is a file
         // insertNode
         jTreeModel.insertNodeInto (insert, insertParent, counter);
         System.out.println (">>>fileCASE insert "+counter+"> " + String.valueOf(insert) +
         "\ninsertParent -> " + String.valueOf(insertParent)
    counter ++;
    // reset index and counter for the next loop
    index = 0;
    counter = 0;
    // reset cut var
    varCut = null;
    // remove the node (automatically deletes subfolders and files)
    dmt.removeNodeFromParent (lastCopiedNode);
    // if node is a copied one
    if varCut == null)
         // insert copied node the same way as for cut one's
         // to make it possible to copy more than one node
    }

    You need to use a recursive copy method to do this. Here's a simple example of the copy. To do a cut you need to do a copy and then delete the source.
    import java.io.*;
    import javax.swing.*;
    import javax.swing.tree.*;
    import java.awt.BorderLayout;
    import java.awt.Container;
    import java.awt.event.*;
    import java.util.*;
    public class CopyTree extends JFrame
         Container cp;
         JTree cTree;
         JScrollPane spTree;
         DefaultTreeModel cModel;
         CNode cRoot;
         JMenuBar menuBar = new JMenuBar();
         JMenu editMenu = new JMenu("Edit");
         JMenuItem copyItem = new JMenuItem("Copy");
         JMenuItem pasteItem = new JMenuItem("Paste");
         TreePath [] sourcePaths;
         TreePath [] destPaths;
         // =====================================================================
         // constructors and public methods
         CopyTree()
              super("Copy Tree Example");
              addWindowListener(new WindowAdapter()
              {public void windowClosing(WindowEvent evt){System.exit(0);}});
              // edit menu
              copyItem.addActionListener(new ActionListener()
              {public void actionPerformed(ActionEvent e){mnuCopy();}});
              editMenu.add(copyItem);
              pasteItem.addActionListener(new ActionListener()
              {public void actionPerformed(ActionEvent e){mnuPaste();}});
              editMenu.add(pasteItem);
              menuBar.add(editMenu);
              setJMenuBar(menuBar);
              buildModel();
              cp = getContentPane();
              cTree = new JTree(cModel);
              spTree = new JScrollPane(cTree);
              cp.add(spTree, BorderLayout.CENTER);
              pack();
         static public void main(String [] args)
              new CopyTree().show();
         // =====================================================================
         // private methods - User Interface
         private void mnuCopy()
              sourcePaths = cTree.getSelectionPaths();
         private void mnuPaste()
              TreePath sp, dp;
              CNode sn,dn;
              int i;
              destPaths = cTree.getSelectionPaths();
              if(1 == destPaths.length)
                   dp = destPaths[0];
                   for(i=0; i< sourcePaths.length;i++)
                        sp = sourcePaths;
                        if(sp.isDescendant(dp) || dp.isDescendant(sp))
                             JOptionPane.showMessageDialog
                                  (null, "source and destinations overlap","Paste", JOptionPane.ERROR_MESSAGE);
                             return;
                   dn = (CNode)dp.getLastPathComponent(); // the node we will append our source to
                   for(i=0; i< sourcePaths.length;i++)
                        sn = (CNode)sourcePaths[i].getLastPathComponent();
                        copyNode(sn,dn);
              else
                   JOptionPane.showMessageDialog
                        (null, "multiple destinations not allowed","Paste", JOptionPane.ERROR_MESSAGE);
         // recursive copy method
         private void copyNode(CNode sn, CNode dn)
              int i;
              CNode scn = new CNode(sn);      // make a copy of the node
              // insert it into the model
              cModel.insertNodeInto(scn,dn,dn.getChildCount());
              // copy its children
              for(i = 0; i<sn.getChildCount();i++)
                   copyNode((CNode)sn.getChildAt(i),scn);
         // ===================================================================
         // private methods - just a sample tree
         private void buildModel()
              int k = 0;
              cRoot = new CNode("root");
              cModel = new DefaultTreeModel(cRoot);
              CNode n1a = new CNode("n1a");
              cModel.insertNodeInto(n1a,cRoot,k++);
              CNode n1b = new CNode("n1b");
              cModel.insertNodeInto(n1b,cRoot,k++);
              CNode n1c = new CNode("n1c");
              cModel.insertNodeInto(n1c,cRoot,k++);
              CNode n1d = new CNode("n1d");
              cModel.insertNodeInto(n1d,cRoot,k++);
              k = 0;
              CNode n1a1 = new CNode("n1a1");
              cModel.insertNodeInto(n1a1,n1a,k++);
              CNode n1a2 = new CNode("n1a2");
              cModel.insertNodeInto(n1a2,n1a,k++);
              CNode n1a3 = new CNode("n1a3");
              cModel.insertNodeInto(n1a3,n1a,k++);
              CNode n1a4 = new CNode("n1a4");
              cModel.insertNodeInto(n1a4,n1a,k++);
              k = 0;
              CNode n1c1 = new CNode("n1c1");
              cModel.insertNodeInto(n1c1,n1c,k++);
              CNode n1c2 = new CNode("n1c2");
              cModel.insertNodeInto(n1c2,n1c,k++);
         // simple tree node with copy constructor
         class CNode extends DefaultMutableTreeNode
              private String name = "";
              // default constructor
              CNode(){this("");}
              // new constructor
              CNode(String n){super(n);}
              // copy constructor
              CNode(CNode c)
                   super(c.getName());
              public String getName(){return (String)getUserObject();}
              public String toString(){return  getName();}

  • JTree - How do I fire a valueChange Event from a keyPressed Event?

    Hi,
    I have been stumped trying to figure out how to fire a valueChange event in my JTree from a keyPressed event.
    When a user changes tree node using the mouse a valueChange event fires. In my program the valueChange executes some code that must be done. I want to get my JTree to work, so that if a user is nagivating the tree using the keyboard, the code is only executed if they press the enter key.
    Below is a little demo program of what I am attempting to accomplish. Any suggestions would be greating appriciated.
    Thanks,
    Corey
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.KeyEvent;
    import java.awt.event.KeyListener;
    import java.awt.event.MouseAdapter;
    import java.awt.event.MouseEvent;
    import javax.swing.tree.*;
    import javax.swing.event.*;
    public class SimpleTreeDemo extends JFrame  {
      public SimpleTreeDemo() {
      public static void main(String args[]) {
        JFrame j = new SimpleTreeDemo();
        DefaultMutableTreeNode category = new DefaultMutableTreeNode("Top of JTree");
        DefaultMutableTreeNode leaf1 = new DefaultMutableTreeNode("leaf1");
        DefaultMutableTreeNode leaf2 = new DefaultMutableTreeNode("leaf2");
        category.add(leaf1); category.add(leaf2);
        final JTree jtree = new JTree(category);
        boolean bflag = false;
        jtree.addTreeSelectionListener(new TreeSelectionListener() {
             public void valueChanged(TreeSelectionEvent e) {
                  System.out.println("valueChanged");
                  if (bflag)
                       // Execute Code
        jtree.addKeyListener(new KeyListener() {
            public void keyTyped(KeyEvent ke) {
              System.out.println("keyTyped");
            public void keyPressed(KeyEvent ke) {
                 System.out.println("keyPressed");
                 if (ke.getKeyCode() == KeyEvent.VK_ENTER)
                      bflag = true;
                    // Fire valueChanged here!
            public void keyReleased(KeyEvent ke) {
                 System.out.println("keyReleased");}
        Container c = j.getContentPane();
        c.add(jtree);
        j.setSize(200,200);
        j.show();

    Try this, it works for me.
    // Tree Key Listener
          tree.addKeyListener(new java.awt.event.KeyAdapter() {
             public void keyPressed(KeyEvent e) {
                tree_KeyReleased(e);
    private void tree_KeyReleased(KeyEvent e) {
          try {
          int keyCode = e.getKeyCode();
          // Get the Tree Path
          TreePath selPath = tree.getSelectionPath();
          if (keyCode == e.VK_DELETE) { //KeyCode - 127
             removeSelectedNode(); // Remove the node
          else if (keyCode == e.VK_ADD) { // Key Code - 107
             tree.expandPath(selPath); // Expand the Node
          else if (keyCode == e.VK_SUBTRACT) { // Key Code 109
             tree.collapsePath(selPath); // Collapse the Node
          else if (keyCode == e.VK_ENTER) {
              // What Ever you want to do here
          else {
          } catch (NullPointerException ex) {
          //System.out.println("Null");
    [/code                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • JTree - make visible new node

    I have added a new DefaultMutableTreeNode, as follows, to a JTree:
    DefaultMutableTreeNode root;
    jTree = new JTree(root);
    DefaultTreeModel treeModel = new DefaultTreeModel(root);
    DefaultMutableTreeNode node = new DefaultMutableTreeNode();
    treeModel.insertNodeInto(node, root, root.getChildCount());
    now I want to display this new node in the JTree at run time (i.e. JTree updates and displays new node within GUI).
    (the JTree is within a JScrollPane).
    I have tried methods makeVisible(.), setPathToVisible(.) without success.
    What is the easiest way to do this?
    thanks in advance.

    I've used JTree.scrollPathToVisible(TreePath)

  • SDO_OCIObjectFree  cost much time???

    We are developing GIS software based on Oracle 8.16. Our software must operate large volume spatial data(1TB). But Speed is our bottle-neck . For a example:
    There are 93664 lines, 1250000 points. Our system take 33 seconds to fetch all of data from Oracle 8.1.6. It is too slow. Because spatial data muse be displayed quickly in GIS.
    The server computer:
    Dell Poweredge 4400
    cpu: P3 933
    memory : 1G
    and the oracle SGA is enough large.How much time is the normal speed?
    When I read spatial geometry object from oracle, the speed is slow. But I read other type data from oracle, the speed is high.
    When I read a spatial geometry object from oracle, whether oracle must new a object and I must delete the object? I found that deleting objects cost much time ( 1/4 sum time) . I believe that the process of creating objects also cost much time!?? Mybe it is net-bottle. Has method to resolve is??
    the following is my program:
    static SDO_GEOMETRY_TYPE *global_geom_obj[ARRAY_SIZE];/* spatial object buffer */
    static SDO_GEOMETRY_ind *global_geom_ind[ARRAY_SIZE]; /* Object indicator */
    checkerr(errhp, SDO_OCIDefineByPos(stmthp, &defn2p, errhp, (ub4)2,
    (dvoid *)0, (sb4)0, SQLT_NTY, (dvoid *)0,
    (ub2 *)0, (ub2 *)0, (ub4)OCI_DEFAULT));
    checkerr(errhp, SDO_OCIDefineObject(defn2p, errhp, geom_tdo,
    (dvoid **)global_geom_obj, (ub4 *)0,
    (dvoid **)global_geom_ind, (ub4 *)0));
    status = OCIStmtExecute(svchp, stmthp, errhp, (ub4)ARRAY_SIZE, (ub4)0,
    (OCISnapshot *)NULL, (OCISnapshot *)NULL,
    (ub4)OCI_DEFAULT);
    while (has_more_data)
    status = OCIStmtFetch(stmthp, errhp, (ub4)ARRAY_SIZE,
    (ub2)OCI_FETCH_NEXT, (ub4)OCI_DEFAULT);
    // SDO_OCIObjectFree,deleting objects cost much time, the process of oracle creating object also cost much time???????????????????????????????
    checkerr(errhp, SDO_OCIObjectFree(envhp, errhp, (dvoid *)global_geom_obj[row], (ub2)OCI_OBJECTFREE_FORCE));
    global_geom_obj[row] = NULL;
    Does anybody know why and how can I do?
    Thanks!

    hm, what is codeData? is it possible to post the whole code?
    a small test shows that the bottleneck is not in the JTree code:
    import javax.swing.*;
    import javax.swing.tree.*;
    import java.awt.*;
    public class TreeTest {
       public static void main(String [] arg) throws Exception {
          long start = System.currentTimeMillis();
          JFrame frame = new JFrame("JTreeTextNodes");
          JTree tree = new JTree();
          DefaultMutableTreeNode root = new DefaultMutableTreeNode("root");
          for(int i=0; i<6000; i++) {
             root.add(new DefaultMutableTreeNode("Node "+i));
          DefaultTreeModel model = new DefaultTreeModel(root);
          tree.setModel(model);
          frame.getContentPane().add(new JScrollPane(tree));
          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          frame.pack();
          frame.show();
          System.out.println(System.currentTimeMillis()-start);
    }takes less than a second to execute on my machine win2k,1.5Ghz, java 1.4.2
    asjf

  • When generate automatically a JTable after a click on a tree node

    final int x[] = {0, 1, 2, 22, 0, 2, 0, 1, 0, 2};
    final int y[] = {0, 0, 0, 0, 1, 1, 2, 2, 3, 3};
    final int larg[] = {1, 1, 20, 1, 2, 21, 1, 22, 2, 22};
    final int haut[] = {1, 1, 1, 1, 1, 1, 1, 1, 22, 22};
    final int px[] = {5, 5, 85, 5, 0, 0, 0, 0, 0, 0};
    final int py[] = {2, 0, 0, 0, 2, 0, 2, 0, 94, 0};
    //****************** POSITIONNEMENT DES COMPOSANTS
    final Container conteneur = getContentPane();
    final GridBagLayout gridBg = new GridBagLayout();
    conteneur.setLayout(gridBg);
    final GridBagConstraints contrainte = new GridBagConstraints();
    contrainte.fill = contrainte.BOTH;
    //*********** JCOMBO1 **************
    borneDate1 = new JComboBox();
    Calendrier req = new Calendrier();
    String[] valCal = req.lireDansTable();
    borneDate1.addItem("");
    for (int i = 0; i<= valCal.length - 1; i++){
          borneDate1.addItem(valCal);
    contrainte.gridx = x[0];
    contrainte.gridy = y[0];
    contrainte.gridwidth = larg[0];
    contrainte.gridheight = haut[0];
    contrainte.weightx = px[0];
    contrainte.weighty = py[0];
    contrainte.insets = new Insets(1, 1, 1, 1);
    contrainte.ipadx = 20;
    gridBg.setConstraints(borneDate1, contrainte);
    conteneur.add(borneDate1);
    //*********** JCOMBO2 **************
    borneDate2 = new JComboBox();
    req = new Calendrier();
    valCal = req.lireDansTable();
    borneDate2.addItem("");
    for (int i = 0; i<= valCal.length - 1; i++){
    borneDate2.addItem(valCal[i]);
    contrainte.gridx = x[1];
    contrainte.gridy = y[1];
    contrainte.gridwidth = larg[1];
    contrainte.gridheight = haut[1];
    contrainte.weightx = px[1];
    contrainte.weighty = py[1];
    gridBg.setConstraints(borneDate2, contrainte);
    conteneur.add(borneDate2);
    //*********** JLABEL1 **************
    lbl1 = new JLabel(" Dates de S�lection.");
    contrainte.gridx = x[2];
    contrainte.gridy = y[2];
    contrainte.gridwidth = larg[2];
    contrainte.gridheight = haut[2];
    contrainte.weightx = px[2];
    contrainte.weighty = py[2];
    gridBg.setConstraints(lbl1, contrainte);
    conteneur.add(lbl1);
    //*********** BOUTON IMPRIMER **************
    btmImprimer = new JButton("IMPRIMER");
    contrainte.gridx = x[3];
    contrainte.gridy = y[3];
    contrainte.gridwidth = larg[3];
    contrainte.gridheight = haut[3];
    contrainte.weightx = px[3];
    contrainte.weighty = py[3];
    gridBg.setConstraints(btmImprimer, contrainte);
    conteneur.add(btmImprimer);
    //*********** BOUTON AUJOURD'HUI **************
    btmAujourdhui = new JButton("Ce jour");
    contrainte.gridx = x[4];
    contrainte.gridy = y[4];
    contrainte.gridwidth = larg[4];
    contrainte.gridheight = haut[4];
    contrainte.weightx = px[4];
    contrainte.weighty = py[4];
    gridBg.setConstraints(btmAujourdhui, contrainte);
    conteneur.add(btmAujourdhui);
    //*********** JLABEL 2 **************
    lbl2 = new JLabel(" Journal.");
    //lbl2.setVisible(false);
    contrainte.gridx = x[5];
    contrainte.gridy = y[5];
    contrainte.gridwidth = larg[5];
    contrainte.gridheight = haut[5];
    contrainte.weightx = px[5];
    contrainte.weighty = py[5];
    gridBg.setConstraints(lbl2, contrainte);
    conteneur.add(lbl2);
    //*********** JLABEL 3 **************
    lbl3 = new JLabel(" Adresse ");
    contrainte.gridx = x[6];
    contrainte.gridy = y[6];
    contrainte.gridwidth = larg[6];
    contrainte.gridheight = haut[6];
    contrainte.weightx = px[6];
    contrainte.weighty = py[6];
    gridBg.setConstraints(lbl3, contrainte);
    conteneur.add(lbl3);
    //*********** JTEXTFIELD **************
    txtPath = new JTextField();
    contrainte.gridx = x[7];
    contrainte.gridy = y[7];
    contrainte.gridwidth = larg[7];
    contrainte.gridheight = haut[7];
    contrainte.weightx = px[7];
    contrainte.weighty = py[7];
    gridBg.setConstraints(txtPath, contrainte);
    conteneur.add(txtPath);
    //*********** JTREE **************
    DefaultMutableTreeNode racine = new DefaultMutableTreeNode("MEDIACAST");
    //**********RECUPERER LES LIGNES ANIMATEUR*******
    parentNode = new DefaultMutableTreeNode("ANIMATEURS");
    racine.add(parentNode);
    GenererEnregistrement enregAnimateur = new GenererEnregistrement();
    String[] sEnregAnim = enregAnimateur.lireDansTable("SELECT numero_anim FROM animateur ORDER BY numero_anim", "numero_anim");
    for(int i = 0; i <= sEnregAnim.length - 1; i++){
    fils = new DefaultMutableTreeNode(sEnregAnim[i]);
    parentNode.add(fils);
    //************RECUPERER LES LIGNES COMPTE******************
    parentNode = new DefaultMutableTreeNode("COMPTES");
    racine.add(parentNode);
    GenererEnregistrement enregCompte = new GenererEnregistrement();
    String[] sEnregCompte = enregCompte.lireDansTable("SELECT id_compte FROM compte ORDER BY id_compte", "id_compte");
    for(int i = 0; i <= sEnregCompte.length - 1; i++){
    fils = new DefaultMutableTreeNode(sEnregCompte[i]);
    parentNode.add(fils);
    //************RECUPERER LES LIGNES DATE******************
    parentNode = new DefaultMutableTreeNode("DATES");
    racine.add(parentNode);
    GenererEnregistrement enregDate = new GenererEnregistrement();
    String[] sEnregDate = enregDate.lireDansTable("SELECT daty FROM calendrier ORDER BY numero_enreg", "daty");
    for(int i = 0; i <= sEnregDate.length - 1; i++){
    fils = new DefaultMutableTreeNode(sEnregDate[i]);
    parentNode.add(fils);
    //*************AFFICHAGE******************
    TreeNode root = racine;
    arbre = new JTree(root);
    JScrollPane paneTree = new JScrollPane();
    //**********EVENEMENT CLICK DROIT DANS JTREE***************
    MouseListener ml = new MouseAdapter() {
    public void mousePressed(MouseEvent e) {
    int selRow = arbre.getRowForLocation(e.getX(), e.getY());
    TreePath selPath = arbre.getPathForRow(selRow);
    if(selRow != -1) {
         if(e.getButton() == 1) {
         txtPath.setText(selPath.toString());
         //**-> CREER LE VECTEUR POUR JTable**<-
         String sPere = txtPath.getText();
         int iResComp = sPere.compareTo("[MEDIACAST, ANIMATEURS]" + arbre.getLastSelectedPathComponent().toString() + "]");
         //****ANIMATEURS***************
         switch(iResComp){
         case -49:
              String sReq = "SELECT animateur.matricule, animateur.prenom, calendrier.daty, compte.id_compte";
              sReq = sReq + " " + "FROM animateur, liaison";
              sReq = sReq + " " + "WHERE animateur.numero_anim = ? AND liaison.numero_anim = ? AND calendrier.daty = liaison.daty";
              String[] sParamIn = {
              arbre.getLastSelectedPathComponent().toString(), arbre.getLastSelectedPathComponent().toString()
              String[] sTypeParamIn = {
              "entier", "entier"
              String[] sParamOut = {
              "matricule", "prenom", "daty", "id_compte"
              GenererEnregistrement enreg = new GenererEnregistrement();
              objEnreg = enreg.retournerToutEnreg(sReq, sParamIn, sTypeParamIn, sParamOut);
              iNbEnreg = enreg.donnerNbEnreg(sReq, sParamIn, sTypeParamIn, sParamOut);
              Object[] teteTable = {
              "Matricule","Prenom","Date", "Numero Compte"
                                            data = clickTreeNode(teteTable.length, iNbEnreg, sParamOut.length, objEnreg);
              tableau = new JTable(data);
                                            //*********** JTABLE **************
              JScrollPane paneTab = new JScrollPane(tableau);
              contrainte.gridx = x[9];
              contrainte.gridy = y[9];
              contrainte.gridwidth = larg[9];
              contrainte.gridheight = haut[9];
              contrainte.weightx = px[9];
              contrainte.weighty = py[9];
              gridBg.setConstraints(paneTab, contrainte);
              conteneur.add(paneTab);
              break;
              else if(e.getButton() == 3) {
                   arbre.setSelectionPath(selPath);//Donne le focus au noeud click�
                   txtPath.setText(selPath.toString());
              //***********POUR LES NOEUDS PERES*******************************
              if(arbre.getLastSelectedPathComponent().toString() == "ANIMATEURS"){
                   System.out.println(selPath.getParentPath().toString());
              //***********POUR LES NOEUDS FILS********************************
              String sPere = txtPath.getText();
              int iResComp = sPere.compareTo("[MEDIACAST, ANIMATEURS]" + arbre.getLastSelectedPathComponent().toString() + "]");
              switch(iResComp){
                   case -49:
                        System.out.println("NOEUDS DANS ANIMATEURS:" + iResComp + " " + arbre.getLastSelectedPathComponent().toString());
                        break;
                   case 2:
                        if(arbre.getLastSelectedPathComponent().toString() != "COMPTES")
                             System.out.println("NOEUDS DANS COMPTES:" iResComp " " + arbre.getLastSelectedPathComponent().toString());
                             break;
                   case 3:
                        if(arbre.getLastSelectedPathComponent().toString() != "DATES")
                             System.out.println("NOEUDS DANS DATES:" + iResComp + " " + arbre.getLastSelectedPathComponent().toString());
                             break;
              arbre.addMouseListener(ml);
              paneTree.setViewportView(arbre);
              contrainte.gridx = x[8];
              contrainte.gridy = y[8];
              contrainte.gridwidth = larg[8];
              contrainte.gridheight = haut[8];
              contrainte.weightx = px[8];
              contrainte.weighty = py[8];
              gridBg.setConstraints(paneTree, contrainte);
              conteneur.add(paneTree);
              //Afficher la fen�tre
              ImageIcon ico = new ImageIcon("c:\\works\\mediacast\\gpao\\hlpglobe.gif");
              this.setIconImage(ico.getImage());
              //this.pack();
              this.setVisible(true);
    I want to generate automatically a table after a click on a tree node but I don't know when to procede

    Please do the following.<br><br>
    #In the location bar, type '''about:config''' and hit Enter.<br><br>
    #In the filter at the top, type: '''keyword.URL'''<br><br>
    #Double click it and remove whatever's in there and replace it with http://www.google.com/search?q= and then click OK.<br><br>
    #Close the tab
    The URL to add in "keyword.URL" becomes a link in this post, so right click it and choose "Copy Link Location" to copy it to the Windows clipboard. Then hit CTRL+V to paste it. Saves you having to type the whole thing.
    '''To reset your home page, do the following'''.<br><br>
    * Go to the site you want to set as your homepage.<br><br>
    * Click the Firefox button, go to '''Options '''| '''Options '''| '''General'''.<br><br>
    * Make sure it says "''Show My Homepage''" in the first dropdown menu.<br><br>
    * Click the button called "'''Use Current Pages'''" to set the homepage to the one you have on the screen.<br>
    N.B. Some of your plugins are out of date which exposes your system to attack. Please visit the [http://www.mozilla.com/en-US/plugincheck/ Plugins Check] page and update where necessary.
    Also, click '''Help '''| '''Check For Updates''' to update Firefox to 3.6.19

  • How can i refresh a jtree using DefaultMutableTreeNode?

    I already create a jtree using DefaultMutableTreeNode, and i also could implement to it the addMouseListener to do a action when the user press every node......Also i used the following instruction to remove all nodes: root_tree.removeAllChildren(); and it instruction remove all the nodes....but when i :
    fill the tree
    compile my program
    i see the tree in my jpanel....it is Ok!
    now.....
    fill the tree
    remove the tree
    compile my program
    i see only the root (this i wish) it is Ok!
    But now i would like that after that i press a combo element (in the actionperformed method):
    remove the tree
    fill the three with the new nodes
    show the tree
    But my tree always is the same :(......is like it to need a repaint ....but i already implement it...but i obtain the same result.....
    Do somebody have any suggestion...or idea how i can do a refresh in my jtree?....
    Anybody could help me please?
    Thanks in advance.....
    Mary

    Construct your tree like this:DefaultMutableTreeNode rootNode = xxx;
    DefaultTreeModel model = new DefaultTreeModel( rootNode );
    JTree tree = new JTree( model );When you update the root node, just tell the model to fire the appropriate change event by doing this:model.reload( rootNode );or this:model.nodeStructureChanged( rootNode );or this:model.setRoot( rootNode )

  • JTree custom DefaultTreeCellRenderer with custom DefaultMutableTreeNode

    Is there a way to create my own version of DefaultTreeCellRenderer that does not use DefaultMutableTreeNode? I tried copying an example of a custom DefaultTreeCellRenderer but I can’t cast the "value" in getTreeCellRendererComponent() to my own version of DefaultMutableTreeNode.
    From the looks of the documentation below shouldn't I be able to do that?
    Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus)

    oops,
    I found out why. I created my custom DefaultTreeCellRenderer before I populated the root node with my DefaultMutableTreeNode. So I guess, java went with the default. When I created my custom DefaultTreeCellRenderer after I populated the root node, everything worked.

  • In the JTree model,how can I transfer DefaultMutableTreeNode into Node?

    In the JTree model,how can I transfer DefaultMutableTreeNode into Node?

    hi,
    add it to the jtree.getModel().getRoot().add(node);
    Cheers,
    Gokul

  • JTree from DefaultMutableTreeNode

    Hi all,
    I am not sure of this. I have DefaultMutableTreeNode refrence of a JTree.
    There are lot of trees and DefaultMutableTreeNode instances are different for each JTree.
    Is it possible to get the JTree reference from DefaultMutableTreeNode
    Thanks,
    sur.

    you need to cast the child to a DefaultMutableTreeNode before you can get the user object

  • How do I use JPanel as a leaf in JTree ?

    Hi All,
    I am a bit of a newbie and I've been trying to change the behavior of my application.
    I have a JTree that I now want to change the rendering of a leaf to be a JPanel. The JPanel will have a couple of JButtons and some text and the user can interact with the JButtons. I was successful in creating the JPanel, adding the buttons and then making my own TreeCellRenderer. Everything displays fine, but the user can not interact with the JButtons, whenever I click on a button in the leaf, the whole leaf is highlighted - I suppose I should not be surprised because this is probably behaving just a cell in a JTree should.
    So I searched the forums and used Google and have found several examples of people using JCheckBox as nodes/leaf(s) in a JTree but none with a JPanel as a leaf. I took one of the check box demos from here ( [http://www.coderanch.com/t/330630/Swing-AWT-SWT-JFace/java/add-swing-component-tree]) and then hacked it a bit but am stuck with the following error :
    Exception in thread "main" java.lang.ClassCastException: java.lang.String cannot be cast to javax.swing.JPanel
    which is pointing to the line with JPanel temp2 = (JPanel) temp.getUserObject();
    Does anyone have either some code or suggestions to accomplish a leaf as a JPanel with some buttons ?
    Thanks in advance !
    import javax.swing.*;*
    *import javax.swing.tree.*;
    import java.awt.event.*;*
    *import java.awt.*;
    public class treedemo1 extends JFrame {
        public treedemo1() {
            super("TreeDemo");
            setSize(1500, 1500);
            JPanel p = new JPanel();
            p.setLayout(new BorderLayout());
            customLeafPanel cp1 = new customLeafPanel();
            customLeafPanel cp2 = new customLeafPanel();
            customLeafPanel cp3 = new customLeafPanel();
            DefaultMutableTreeNode root = new DefaultMutableTreeNode("Query Results");
            DefaultMutableTreeNode n1 = new DefaultMutableTreeNode(cp1, false);
            DefaultMutableTreeNode n2 = new DefaultMutableTreeNode(cp2, false);
            DefaultMutableTreeNode n3 = new DefaultMutableTreeNode(cp3, false);
            root.add(n1);
            root.add(n2);
            root.add(n3);
            JTree tree = new JTree(root);
            p.add(tree, BorderLayout.NORTH);
            getContentPane().add(p);
            TestRenderer tr = new TestRenderer();
            tree.setEditable(false);
            tree.setCellRenderer(tr);
        public class customLeafPanel extends JPanel {
            public customLeafPanel() {
                JPanel clpPanel = new JPanel();
                JButton helloJButton = new JButton("Hello");
                this.add(helloJButton);
        public class TestRenderer implements TreeCellRenderer {
            transient protected Icon closedIcon;
            transient protected Icon openIcon;
            public TestRenderer() {
            public Component getTreeCellRendererComponent(JTree tree,
                    Object value,
                    boolean selected,
                    boolean expanded,
                    boolean leaf,
                    int row,
                    boolean hasFocus) {
                DefaultMutableTreeNode temp = (DefaultMutableTreeNode) value;
                JPanel temp2 = (JPanel) temp.getUserObject();
                return temp2;
            public void setClosedIcon(Icon newIcon) {
                closedIcon = newIcon;
            public void setOpenIcon(Icon newIcon) {
                openIcon = newIcon;
        public static void main(String args[]) {
            JFrame frame = new treedemo1();
            frame.addWindowListener(new WindowAdapter() {
                public void windowClosing(WindowEvent e) {
                    System.exit(0);
            frame.pack();
            frame.setVisible(true);
    }

    Thank you TBM and DB for your replies ! Adding TBM's code does indeed fix the JPanel issue and as TBM indicated this does not actually solve my ultimate problem (Can I give you each 1/2 the Duke points?)
    As a newbie, I am still learning and DB pointed out that "You can however interact with an editor". So after reading the suggested tutorials and looking back at the example code that I hacked. I added the cellEditor back in and it WORKS ! Its funny, I deleted that bits of code from the example, assuming the cellEditor allows you to "edit" (ie change), not interact with it (symantics I guess)
    Thanks again guys for pointing this newbie in the right direction. Frankly I am somewhat surprised that I could finally begin to read and understand what the tutorial and suggestions are telling me ! What is one step up from a newbie ?
    unfortunately I can not post the code because the length of the message is > 5000 :(

Maybe you are looking for

  • Difficulty displaying numeric info in text field

    I'm trying to display the playheadTime of an FLV movie (called vid_player) on the stage in a test field (called myTextField). I used to be able to do this in older actionscript, but with AS3, I'm having a heck of a time. Here's my code: function getC

  • How to put ipod in recovery mode without a home button ???

    how to put ipod in recovery mode without a home button and i cant get in to my devise what can i do ???????????

  • Swf into html- explorer problem

    I have this code: and it looks perfect with firefox, but the problem is in explorer :( do not see it completely what am I doing wrong? the full website is here: http://www.geocities.com/aniaacolgate thank you in advance for reply

  • BRAS/IP Profile reset.

    Right, I'm finally sick being stuck on a line profile of 26520Kbps when I know my line is capable of syncning at 40Mb (Result of a stupid voice fault from a few months ago). How do I get in touch with the mods to get the BRAS profile reset? Many than

  • FM  KD_GET_FILENAME_ON_F4

    Hi, How can  I assign to a textinput field on the dynpro the following Function Module  KD_GET_FILENAME_ON_F4. Thus the user can select conveniently file . Regards sas