Jtree node refuses to collapse upon clicking handle; makeVisible() was used

Hello,
While creating a new node and inserting as a leaf in the JTree, I use tree.makeVisible(newTreePath) to expand the new node and make visible. (Using expandPath() will not expand if a leaf was added).
However now the jtree node refuses to collapse upon clicking the node handle.
How do I get it to not insist on staying open - be able to collapse manually?
thanks,
Anil

This is the JNI forum. I don't believe your post fits.
then
can I correctly assume that any class that
"implements Cloneable" will handle making either a
"shallow" or "deep" ... or even "semi-shallow" clone,
respective to the class context .. right?
It probably does something. The implementor might not have implemented anything though. And you have no idea what they implemented.
No idea about your other question.
You might want to think carefully about why you are cloning though.

Similar Messages

  • Parse and display xml doc when click on JTree node?

    Ok so here is the code that I have now. You will have to make alot of html files to run the program, but they can be empty for now. What you can do is just put the same exact html file to be displayed in each node element. for example.
    DefaultMutableTreeNode n1_node1_b1 =
                        new DefaultMutableTreeNode(new ModuleInfo("Device", "device.html"));could be changed to
    DefaultMutableTreeNode n1_node1_b1 =
                        new DefaultMutableTreeNode(new ModuleInfo("Device", "status.html"));And just keep adding the status.html page to each one of the nodes.
    anyway.
    For now when I click on the node, the html file is displayed in the JScrollPane rPane = new JScrollPane(htmlPane); and the htmlPane is a JEditorPane
    what I need it to do.
    When I click on the JTree node. I would like to go out to an xml file, parse the information in it, and display it to the pane.
    I will need to later, be able to add, edit, or delete information on the xml through the pane later.
    import java.util.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.tree.*;
    import javax.swing.JTree;
    import javax.swing.JPanel;
    import javax.accessibility.*;
    import javax.swing.UIManager;
    import javax.swing.JComponent;
    import javax.swing.JEditorPane;
    import javax.swing.tree.TreeSelectionModel;
    import javax.swing.event.TreeSelectionEvent;
    import javax.swing.event.TreeSelectionListener;
    import javax.swing.tree.DefaultTreeCellRenderer;
    import javax.swing.ImageIcon;
    import java.net.URL;
    import java.io.IOException;
    import java.awt.Dimension;
    * @author orozcom
    public class Example extends JFrame implements TreeSelectionListener
        private JEditorPane htmlPane;
        private URL helpURL;
        private static boolean DEBUG = false;
        private JTree tree;
        public Example()
            super("Example");
            setSize(1200,900);
            setDefaultCloseOperation(EXIT_ON_CLOSE);
            JMenuBar jmb = new JMenuBar();
            JMenu fileMenu = new JMenu("File");
            JMenuItem openItem = new JMenuItem("Open");
            JMenuItem saveItem = new JMenuItem("Save");
            JMenuItem exitItem = new JMenuItem("Exit");
            exitItem.addActionListener(new ActionListener()
                public void actionPerformed(ActionEvent ae)
                    System.exit(0);
            fileMenu.add(openItem);
            fileMenu.add(saveItem);
            fileMenu.add(new JSeparator());
            fileMenu.add(exitItem);
            jmb.add(fileMenu);
            setJMenuBar(jmb);
            //  **************** start JTree ******************//       
            JPanel lPane =new JPanel();       
            lPane.setLayout(new BorderLayout());
            DefaultMutableTreeNode top = new DefaultMutableTreeNode(new ModuleInfo("Devices","splashScreen.html"));
            DefaultMutableTreeNode branch1 =
                    new DefaultMutableTreeNode(new ModuleInfo("Module 1", "module1.html"));
            DefaultMutableTreeNode branch2 =
                    new DefaultMutableTreeNode(new ModuleInfo("Module 2", "module2.html"));
            //DefaultMutableTreeNode branch3 =
                    //new DefaultMutableTreeNode(new ModuleInfo("Module 3", "module3.html"));
            //adding to the topmost node
            top.add(branch1);
            top.add(branch2);
            //top.add(branch3);
             *          BRANCH 1           *
            //adding to the First branch
            DefaultMutableTreeNode node1_b1
                    =new DefaultMutableTreeNode(new ModuleInfo("Status", "status.html"));
            //branch1.add(node1_b1);
                DefaultMutableTreeNode n1_node1_b1 =
                        new DefaultMutableTreeNode(new ModuleInfo("Device", "device.html"));
                DefaultMutableTreeNode n2_node1_b1 =
                        new DefaultMutableTreeNode(new ModuleInfo("Network", "network.html"));
                DefaultMutableTreeNode n3_node1_b1 =
                        new DefaultMutableTreeNode(new ModuleInfo("Chassis", "chassis.html"));
                DefaultMutableTreeNode n4_node1_b1 =
                        new DefaultMutableTreeNode(new ModuleInfo("Resources", "resources.html"));
                node1_b1.add(n1_node1_b1);
                node1_b1.add(n2_node1_b1);
                node1_b1.add(n3_node1_b1);
                node1_b1.add(n4_node1_b1);    
            DefaultMutableTreeNode node2_b1 =
                    new DefaultMutableTreeNode(new ModuleInfo("Project Editor", "projedit.html"));
            DefaultMutableTreeNode node3_b1 =
                    new DefaultMutableTreeNode(new ModuleInfo("Project Manager", "projmngt.html"));
            DefaultMutableTreeNode node4_b1 =
                    new DefaultMutableTreeNode(new ModuleInfo("Administration", "administration.html"));
            DefaultMutableTreeNode n1_node4_b1 =
                    new DefaultMutableTreeNode(new ModuleInfo("Device", "device.html"));
            DefaultMutableTreeNode n2_node4_b1 =
                    new DefaultMutableTreeNode(new ModuleInfo("Network", "network.html"));
            DefaultMutableTreeNode n3_node4_b1 =
                    new DefaultMutableTreeNode(new ModuleInfo("Users", "users.html"));
            node4_b1.add(n1_node4_b1);
            node4_b1.add(n2_node4_b1);
            node4_b1.add(n3_node4_b1);
            DefaultMutableTreeNode node5_b1 =
                    new DefaultMutableTreeNode(new ModuleInfo("Logging", "logging.html"));
            branch1.add(node1_b1);
            branch1.add(node2_b1);
            branch1.add(node3_b1);
            branch1.add(node4_b1);
            branch1.add(node5_b1);
             *          BRANCH 2           *
            //adding to the Second branch
            DefaultMutableTreeNode node1_b2 =
                    new DefaultMutableTreeNode(new ModuleInfo("Status", "status.html"));
                DefaultMutableTreeNode n1_node1_b2 =
                        new DefaultMutableTreeNode(new ModuleInfo("Device", "device.html"));
                DefaultMutableTreeNode n2_node1_b2 =
                        new DefaultMutableTreeNode(new ModuleInfo("Network", "network.html"));
                DefaultMutableTreeNode n3_node1_b2 =
                        new DefaultMutableTreeNode(new ModuleInfo("Chassis", "chassis.html"));
                DefaultMutableTreeNode n4_node1_b2 =
                        new DefaultMutableTreeNode(new ModuleInfo("Resources", "resources.html"));
                node1_b2.add(n1_node1_b2);
                node1_b2.add(n2_node1_b2);
                node1_b2.add(n3_node1_b2);
                node1_b2.add(n4_node1_b2);
            DefaultMutableTreeNode node2_b2=
                    new DefaultMutableTreeNode(new ModuleInfo("Project Editor", "projedit.html"));
            DefaultMutableTreeNode node3_b2=
                    new DefaultMutableTreeNode(new ModuleInfo("Project Manager", "projmngt.html"));
            DefaultMutableTreeNode node4_b2=
                    new DefaultMutableTreeNode(new ModuleInfo("Administration", "administration.html"));
                DefaultMutableTreeNode n1_node4_b2=
                        new DefaultMutableTreeNode(new ModuleInfo("Device", "device.html"));
                DefaultMutableTreeNode n2_node4_b2=
                        new DefaultMutableTreeNode(new ModuleInfo("Network", "network.html"));
                DefaultMutableTreeNode n3_node4_b2=
                        new DefaultMutableTreeNode(new ModuleInfo("Users", "users.html"));
                node4_b2.add(n1_node4_b2);
                node4_b2.add(n2_node4_b2);
                node4_b2.add(n3_node4_b2);
            DefaultMutableTreeNode node5_b2=
                    new DefaultMutableTreeNode(new ModuleInfo("Logging", "logging.html"));
            branch2.add(node1_b2);
            branch2.add(node2_b2);
            branch2.add(node3_b2);
            branch2.add(node4_b2);
            branch2.add(node5_b2);
             *          BRANCH 3           *
            //adding to the Third branch
            DefaultMutableTreeNode node1_b3=new DefaultMutableTreeNode("Status");
            DefaultMutableTreeNode n1_node1_b3=new DefaultMutableTreeNode("Device");
            DefaultMutableTreeNode n2_node1_b3=new DefaultMutableTreeNode("Network");
            DefaultMutableTreeNode n3_node1_b3=new DefaultMutableTreeNode("Chassis");
            DefaultMutableTreeNode n4_node1_b3=new DefaultMutableTreeNode("Resources");
            node1_b3.add(n1_node1_b3);
            node1_b3.add(n2_node1_b3);
            node1_b3.add(n3_node1_b3);
            node1_b3.add(n4_node1_b3);
            DefaultMutableTreeNode node2_b3=new DefaultMutableTreeNode("Project Editor");
            DefaultMutableTreeNode node3_b3=new DefaultMutableTreeNode("Project Manager");
            DefaultMutableTreeNode node4_b3=new DefaultMutableTreeNode("Administration");
            DefaultMutableTreeNode n1_node4_b3=new DefaultMutableTreeNode("Device");
            DefaultMutableTreeNode n2_node4_b3=new DefaultMutableTreeNode("Network");
            DefaultMutableTreeNode n3_node4_b3=new DefaultMutableTreeNode("Users");
            node4_b3.add(n1_node4_b3);
            node4_b3.add(n2_node4_b3);
            node4_b3.add(n3_node4_b3);
            DefaultMutableTreeNode node5_b3=new DefaultMutableTreeNode("Logging");
            branch3.add(node1_b3);
            branch3.add(node2_b3);
            branch3.add(node3_b3);
            branch3.add(node4_b3);
            branch3.add(node5_b3);
            tree=new JTree(top,true);
            //tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
            tree.getSelectionModel().setSelectionMode(TreeSelectionModel.CONTIGUOUS_TREE_SELECTION);
            //Set the icon for leaf nodes.       
            ImageIcon deviceIcon = createImageIcon("/device.gif");       
            if (deviceIcon != null)
                DefaultTreeCellRenderer renderer = new DefaultTreeCellRenderer();
                renderer.setLeafIcon(deviceIcon);
                tree.setCellRenderer(renderer);
            else
                System.err.println("Leaf icon missing; using default.");
            //Listen for when the selection changes.
            tree.addTreeSelectionListener(this);
            //Create the scroll pane and add the tree to it.
            //JScrollPane treeView = new JScrollPane(tree);
            tree.setToolTipText(" and ");
            lPane.add(tree);
            getContentPane().add(lPane);
            //  ****************  end  JTree  ******************//
            htmlPane = new JEditorPane();
            htmlPane.setEditable(false);       
            initHelp();
            JScrollPane rPane = new JScrollPane(htmlPane);
            JSplitPane jsp = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, lPane, rPane);
            jsp.setDividerLocation(180);
            getContentPane().add(jsp, BorderLayout.CENTER);
            JPanel bPane = new JPanel();
            JButton okButton = new JButton("Ok");
            JButton applyButton = new JButton("Apply");
            JButton clearButton = new JButton("Clear");
            bPane.add(okButton);
            bPane.add(applyButton);
            bPane.add(clearButton);
            getContentPane().add(bPane, BorderLayout.SOUTH);
            setVisible(true);
        /** Required by TreeSelectionListener interface. */
        public void valueChanged(TreeSelectionEvent e)
            DefaultMutableTreeNode node = (DefaultMutableTreeNode)
            tree.getLastSelectedPathComponent();
            if (node == null) return;
            Object nodeInfo = node.getUserObject();
            if (node.isLeaf())
                ModuleInfo module = (ModuleInfo)nodeInfo;
                displayURL(module.moduleURL);
                if (DEBUG)
                    System.out.print(module.moduleURL + ":  \n    ");
            else
                displayURL(helpURL);
            if (DEBUG)
                System.out.println(nodeInfo.toString());
        private class ModuleInfo
            public String deviceName;
            public URL moduleURL;
            public ModuleInfo(String device, String filename)
                deviceName = device;
                moduleURL = (URL)Example.class.getResource("/" + filename);
                if (moduleURL == null)
                    System.err.println("Couldn't find file: "
                            + filename);
            public String toString()
                return deviceName;
        private void initHelp()
            String s = "YFDemoHelp.html";
            helpURL = Example.class.getResource("/" + s);
            if (helpURL == null)
                System.err.println("Couldn't open help file: " + s);
            else if (DEBUG)
                System.out.println("Help URL is " + helpURL);
            displayURL(helpURL);
        private void displayURL(URL url)
            try
                if (url != null)
                    htmlPane.setPage(url);
                else
                { //null url
                    htmlPane.setText("File Not Found");
                    if (DEBUG)
                        System.out.println("Attempted to display a null URL.");
            catch (IOException e)
                System.err.println("Attempted to read a bad URL: " + url);
        /** Returns an ImageIcon, or null if the path was invalid. */
        protected static ImageIcon createImageIcon(String path)
            java.net.URL imgURL = Example.class.getResource(path);
            if (imgURL != null)
                return new ImageIcon(imgURL);
            else
                System.err.println("Couldn't find file: " + path);
                return null;
        public static void main(String args[])
            new Example();
            //new AssistiveExample();
    }Thanks orozcom

    yes i can at the time of MIRO u can see both
    go in SU01 for and user
    in Parameters enter IVFIDISPLAY in Parameter ID and X in Paramater Value
    thus for that user u will be able to c Invoice number and accounting number after saving MIRo
    u will get message like
    Invoice document 5105608893 was posted ( Accountng Documnt: 5100000000 )
    hope this helps

  • How to post an Event (mouse left click) to JTree node

    Hi,
    I am using JTree for my application just like the windows explorer tree. By default, Jtree node will got focus using left click. But, I'd like that my tree will detect a right click so that I can copy any file to the Jtree. I've added a mouselistener to it but the node is not selected by the right click. Anyboby can teach me how to post a mouse left click event to the Jtree so that it will become selected using left click.
    Thanks a million

    See if this is useful
    public void mouseClicked(MouseEvent event)
    Object object = event.getSource();
    if (object == mTree)
    mTree_mouseClicked(event);
    private void mTree_mouseClicked(MouseEvent event)
    if(event.getModifiers()==event.BUTTON3_MASK)
    //your logic goes here
    }//close method

  • How to hide node handles (legs) from JTree nodes?

    Hello,
    Does anyone has an idea on how to not display JTree node handles (legs)?
    Thank you,
    Mindaugas

    You can do it with Java/Metal look and feel by doing this:
    JTree tree = new JTree(...);
    tree.setClientProperty("JTree.lineStyle", "None");
    For any other L&F, you will have to look at the UI code.
    Mitch Goldstein
    Author, Hardcore JFC

  • Restricting Jtree node from collapsing.

    Hi all,
    Is there any way by which i can restrict a Jtree node from collapsing?
    please help,
    thx,
    Soni.

    hi
    i got it,
    here is the solution
    tree.addTreeWillExpandListener(new TreeWillExpandListener() {
    public void treeWillExpand(TreeExpansionEvent e)throws ExpandVetoException {
    public void treeWillCollapse(TreeExpansionEvent e)throws ExpandVetoException {
    TreePath p = e.getPath();
    DefaultMutableTreeNode n =
    (DefaultMutableTreeNode)p.getLastPathComponent();
    if (n == root) {
    throw new ExpandVetoException(e);
    -Soni

  • How to change icons of a JTree node dynamically

    Hi all!
    I want to change icon associated with a node dynamically ( i.e. after the tree has being displayed). How can i achieve this?
    Can any one provide me a sample code snippet.
    Thanks in advance
    Murali

    I have created CustomCellRenderer and i'm calling this class as follows
    tree.setCellRenderer((TreeCellRenderer) new CustomCellRenderer(true));
    The boolean value for the constructor (in this case it's true) will be set to
    a local variable in the CustomCellRenderer class. Then upon clicking a node in the tree the boolean value (true) is set and the icon for that node should be changed as specified in the CustomCellRenderer class.
    When i click on a node all the icons of that tree are disappearing.
    Can any one help me in this issue
    public class CustomCellRenderer
              extends          JLabel
              implements     TreeCellRenderer
    private ImageIcon          grayfolderImage;
    private ImageIcon          greenfolderImage;
    private ImageIcon          bluefolderImage;
    private ImageIcon          redfolderImage;
    private ImageIcon          whitefolderImage;
    private boolean               bSelected;
    boolean logfileDeleted;
         public CustomCellRenderer()
              grayfolderImage = new ImageIcon("C:\\images\\grayFolder.gif");     
              greenfolderImage = new ImageIcon("C:\\images\\greenFolder.gif");     
              bluefolderImage = new ImageIcon("C:\\images\\blueFolder.gif");     
              redfolderImage = new ImageIcon("C:\\images\\redFolder.gif");
              whitefolderImage = new ImageIcon("C:\\images\\whiteFolder.gif");     
         public CustomCellRenderer(boolean logfileDeleted){
              this.logfileDeleted = logfileDeleted;
         public Component getTreeCellRendererComponent( JTree tree,
                             Object value, boolean bSelected, boolean bExpanded,
                                       boolean bLeaf, int iRow, boolean bHasFocus )
              // Find out which node we are rendering and get its text
              DefaultMutableTreeNode node = (DefaultMutableTreeNode)value;
              String     labelText = (String)node.getUserObject();
              this.bSelected = bSelected;
              // Set the correct foreground color
              /*if( !bSelected )
                   setForeground( Color.black );
              else
                   setForeground( Color.red ); */
              // Determine the correct icon to display
              if( labelText.equals( "ioexception001" ) )
                   setIcon( redfolderImage );
              else if( labelText.equals( "ioexception002" ) )
                   setIcon( greenfolderImage );
              else if( logfileDeleted ==true )
                   setIcon( whitefolderImage );
              else if( labelText.equals( "ioexception004" ) )
                   setIcon( redfolderImage );
              else
                   setIcon(bluefolderImage);
              // Add the text to the cell
              setText( labelText );
              return this;
         // This is a hack to paint the background. Normally a JLabel can
         // paint its own background, but due to an apparent bug or
         // limitation in the TreeCellRenderer, the paint method is
         // required to handle this.
         public void paint( Graphics g )
              Color          bColor;
              Icon          currentI = getIcon();
              // Set the correct background color
              bColor = bSelected ? SystemColor.textHighlight : Color.white;
              g.setColor( bColor );
              // Draw a rectangle in the background of the cell
              g.fillRect( 0, 0, getWidth() - 1, getHeight() - 1 );
              super.paint( g );
    }

  • How to replace original JTree node with + and - sign or icon??

    Dear friends:
    I have following code for JTree:
    import java.awt.BorderLayout;
    import java.awt.Container;
    import javax.swing.JFrame;
    import javax.swing.JScrollPane;
    import javax.swing.JTree;
    public class TreeSample {
      public static void main(String args[]) {
        JFrame f = new JFrame("JTree Sample");
        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        Container content = f.getContentPane();
        JTree tree = new JTree();
        JScrollPane scrollPane = new JScrollPane(tree);
        content.add(scrollPane, BorderLayout.CENTER);
        f.setSize(300, 200);
        f.setVisible(true);
    }Here, when I click any node to explore its children, right handle pointer become down handle Pointer, but if I hope to change this right handle pointer to + sign or icon; and to change this down handle pointer to - sign or icon; how to do it, ??
    Is there any simplest way instead of using ImageIcon ????
    Thanks
    sunny

    You have to use Windows look and feel instead of Java look and feel.
    http://java.sun.com/docs/books/tutorial/uiswing/components/tree.html#display

  • Xml in JTree: how to not collpase JTree node, when renaming XML Node.

    Hi.
    I'm writing some kind of XML editor. I want to view my XML document in JTree and make user able to edit contents of XML. I made my own TreeModel for JTree, which straight accesses XML DOM, produced by Xerces. Using DOM Events, I made good-looking JTree updates without collapsing JTree on inserting or removing XML nodes.
    But there is a problem. I need to produce to user some method of renaming nodes. As I know, there is no way to rename node in w3c DOM. So I create new one with new name and copy all children and attributes to it. But in this way I got a new object of XML Node instead of renamed one. And I need to initiate rebuilding (treeStructureChanged event) of JTree structure. Renamed node collapses. If I use treeNodesChanged event (no rebuilding, just changes string view of JTree node), then when I try to operate with renamed node again, exception will be throwed.
    Is there some way to rename nodes in my program without collpasing JTree?
    I'am new to Java. Maybe there is a method in Xerces DOM implementation to rename nodes without recreating?
    Thanks in advance.

    I assume that "rename" means to change the element name? Anyway your question seems to be "When I add a node to a JTree, how do I make sure it is expanded?" This is completely concerned with Swing, so it might have been better to post it in the Swing forum, but if it were me I would do this:
    1. Copy the XML document into a JTree.
    2. Allow the user to edit the document. Don't attempt to keep an XML document or DOM synchronized with the contents of the JTree.
    3. On request of the user, copy the JTree back to a new XML document.
    This way you can "rename" things to the user's heart's content without having the problem you described.

  • PopupMenu on Jtree nodes Please [b]Help me][/b]

    how can I set my JpopupMenu to work on Jtree nodes and not on the tree?

    how can I set my JpopupMenu to work on Jtree nodes
    and not on the tree?Could you elaborate? Are you asking that popup events are ignored if the mouse click is not actually on the rendered area of a node or are you asking something else?

  • Hiding selection screen fields upon clicking a button

    Hi .
    I have a requirement like we need to hide and bring back the selection screen fields upon clicking a button( Expand and collapse in the same button) .
    in ABAP Query,we can maintain this,  for the variant we created.
    We need this functionality on the selection-screen presently.
    How to achieve this in the selection -screen?
    Valuale pointers are desparately needful.
    Regards,
    SSR.

    Hi,
    SELECTION SECREEN (P_) Parameter
    (S_) Select Options
    SELECTION-SCREEN : BEGIN OF BLOCK BLK1 WITH FRAME TITLE TEXT-001,
    BEGIN OF LINE,
    COMMENT (26) C1 MODIF ID XYZ.
    SELECT-OPTIONS : S_MATNR FOR MARA-MATNR MODIF ID XYZ NO-EXTENSION .
    SELECTION-SCREEN : END OF LINE,
    BEGIN OF LINE,
    COMMENT (26) C2 MODIF ID XYZ.
    SELECT-OPTIONS : S_MATKL FOR MARA-MATKL MODIF ID XYZ NO-EXTENSION .
    SELECTION-SCREEN : END OF LINE.
    PARAMETERS : R_MATNR RADIOBUTTON GROUP RAD1 DEFAULT 'X'
    MODIF ID ABC USER-COMMAND MAT,
    R_MATKL RADIOBUTTON GROUP RAD1.
    SELECTION-SCREEN END OF BLOCK blk1.
    INITIALIZATION.
    C1 = 'Product Code'.
    c2 = 'Product Group'.
    AT SELECTION-SCREEN OUTPUT.
    LOOP AT SCREEN.
    IF SCREEN-NAME0(7) = 'S_MATNR' OR SCREEN-NAME0(7) = 'S_MATKL'.
    SCREEN-INPUT = '0'.
    SCREEN-INVISIBLE = '1'.
    ENDIF.
    CASE SCREEN-NAME+0(7).
    WHEN 'S_MATNR'.
    IF R_MATNR = 'X'.
    SCREEN-INPUT = '1'.
    SCREEN-INVISIBLE = '0'.
    ENDIF.
    WHEN 'S_MATKL'.
    IF R_MATKL = 'X'..
    SCREEN-INPUT = '1'.
    SCREEN-INVISIBLE = '0'.
    ENDIF.
    ENDCASE.
    IF R_MATNR = 'X'.
    IF SCREEN-NAME = 'C1'.
    C1 = 'Product code'.
    C2 = SPACE.
    ENDIF.
    ENDIF.
    IF R_MATKL = 'X'.
    IF SCREEN-NAME = 'C2'.
    C2 = 'Product Group'.
    C1 = SPACE.
    ENDIF.
    ENDIF.
    MODIFY SCREEN.
    ENDLOOP.
    Hope it helps.
    best regards,
    Nagaraj Kalbavi

  • Please help with JTree Node Duplication

    Iam building a JTree which should not allow node duplication.
    1.)First i construct a ArrayList which stores all the previous nodes.
    treeNodeNames=new ArrayList();
    2.)i call the method
              readTreeNodeNames((DefaultMutableTreeNode)dtm.getRoot());
    3.)The method readTreeNodeNames is
    public void readTreeNodeNames(DefaultMutableTreeNode node) {
              if(node.toString().toLowerCase().length()!=0) {
              treeNodeNames.add(node.toString().toLowerCase());
              for(Enumeration en=node.children();en.hasMoreElements();) {
                   DefaultMutableTreeNode childNode=(DefaultMutableTreeNode)en.nextElement();      
                   if(childNode.toString().toLowerCase().length()!=0) {
                        treeNodeNames.add(childNode.toString().toLowerCase());
                   if(!childNode.isLeaf()) {
                        readTreeNodeNames(childNode);
    4.)i have four menu when right click a node add,modify,add subnode,delete.
    node duplication fails in my case.when should i call this method?should i call while doing every above mentioned operations or in TreeModelEvent implementations?
    i have mailed this problem already two times.but no one has not replied.Kinldy consider it and give me a solution.Or anyone having code for JTree Node duplication please send me to [email protected]

    Hi all,
    Any ideas to overcome this problem.?
    Thanks,
    Krish

  • Block input events after selecting JTree node

    Hi,
    I've got a common problem but didn't found any solution for it.
    I try to block input events (key and mouse events) after the user clicks on a tree node in the TreeSelectionListener.
    For normal clicks it works fine.
    If the user make a double click than the blocking mechanism also blocks the mouse events to handle the additional expansion of the tree node.
    Any solutions for this?
    Thanks,
    Steffen

    I use the following code to blocking input events:
          waitTimer = new Timer(350, new ActionListener() {
            public void actionPerformed(ActionEvent e) {
              Toolkit.getDefaultToolkit().addAWTEventListener(awtEventListener,
                  AWTEvent.MOUSE_EVENT_MASK | AWTEvent.MOUSE_WHEEL_EVENT_MASK | AWTEvent.KEY_EVENT_MASK);
          waitTimer.setRepeats(false);
          waitTimer.start();The event listener looks like:
        awtEventListener = new AWTEventListener() {
          public void eventDispatched(AWTEvent anEvent) {
            if(anEvent instanceof InputEvent && anEvent.getSource() instanceof Component)  {
                ((InputEvent) anEvent).consume();
        };

  • Getting jtree node

    hi
    pls help in getting the node from jtree
    not by using getLastSelectedPathComponent() method.
    when i use this method iam getting the node but i want an alternate way of getting the node with out selecting or keeping focus on the node.
    thanks in advance

    yes the second one is right
    i have the problem but unable to explain
    so let me put the thing clear
    i have a window like this
    the main window is divided into two JTabbedPanes
    left side one TabbedPane and Rightside OneTabbed pane
    both of them are added to one frame.
    on the left side JTree will be created 8 nodes are displayed.
    and their root is invisible.
    each node will have a right click menu when we select a node and right click then a context menu appear.
    most of the context menu's will have search and create when we click on search then a popup window appear and selected data will be put into the TabedPanes on the right side for view to the end user.
    when we select create in the context menu a blank window will be added to JTabbedPane in the right side so that user can enter some data init.
    so the issue is when i enter some data in the right hand side window and say i have clicked on save button then it is throwing an exception as node not found (when used getLastSelecetedPathComponent)
    because when i fill data the foucs on the node which was there while right click and select create option from context menu is last .
    the same thing works when i manully select the node before i click on save
    this is the problem
    hope u understood

  • URGENT: Opening JInternalFrame upon click of a button

    Hi can somebody help me, Im a newbie in JDeveloper IDE and have no proper training.
    Im using Oracle Jdeveloper 10.1.3.3.0. My project is an ADF Swing Application.
    Let me explain what I'm trying to do..
    I like to open another JinternalFrame upon click of a button.
    When I click the button. Im passing two parameters(bind variables) to filter the view object
    of the class and displlay its result in JinternalFrame.
    I have a ClassA that extends JinternalFrame, it contains components such as textbox, combo box etc. and a button labeled (Show ClassB).
    I also have ClassB that extends JinternalFrame, its view object required two bind variables.
    In ClassA, it has table and i will select one row and click on a button.
    I will pass the value in the table to the bind variable of the view object of ClassB and open and display the result in JInternalFrame.
    Im getting the parameters, but i cant pass it on the bind attribute of the view object.
    How can I do this in my java class with the relation of its pagedef.
    Im comfused..
    Please help.
    Thanks.

    Hi,
    independent of whether this is a internal frame or a
    panel, you can use
    OperationBinding oper = (OperationBinding)
    panelBinding.get("ExecuteWithParams");
    per.getParameterMap().put("ArgumentName1",argument1);
    oper.getParameterMap().put("ArgumentName2",argument2);
    oper.execute();>
    assuming that the bind variables are exposed in th
    epageDev file as a ExecuteWithParams operation
    Hi Frank,
    I have this code for the button
             private void jButton4_actionPerformed(ActionEvent e) {
                  if (jTableLeft.getValueAt(jTableLeft.getSelectedRow(),0) != null) {
                       System.out.println("quot trans no" + 
                       jTableLeft.getValueAt(jTableLeft.getSelectedRow(),0).toString());
                      quotTransNo = new
                           Integer(jTableLeft.getValueAt(jTableLeft.getSelectedRow(),0).toString());
                 PanelQuotations pq = new PanelQuotations();
                 JUPanelBinding quotbinding = pq.getPanelBinding();
                 System.out.println(quotbinding.getName());
                 OperationBinding oper =
                          (OperationBinding)quotbinding.get("ExecuteWithParams");
                 oper.getParamsMap().put("param_quotTransNo",quotTransNo);
                 System.out.println("Bago na to");
                 oper.execute();
                openQuotation();//opens new JInternalFrame          
        }When I testes it, it gave me a "Null Pointer Exception" in this line
    oper.getParamsMap().put("param_quotTransNo",quotTransNo);
    Why am I getting such error? I dont know why?
    Thanks.

  • How to move a selected row data from one grid to another grid using button click handler in flex4

    hi friends,
    i am doing flex4 mxml web application,
    i am struck in this concept please help some one.
    i am using two seperated forms and each form having one data grid.
    In first datagrid i am having 5 rows and one button(outside the data grid with lable MOVE). when i am click a row from the datagrid and click the MOVE button means that row should disable from the present datagrid and that row will go and visible in  the second datagrid.
    i dont want drag and drop method, i want this process only using button click handler.
    how to do this?
    any suggession or snippet code are welcome.
    Thanks,
    B.venkatesan.

    Hi,
    You can get an idea from foolowing code and also from the link which i am providing.
    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
    width="613" height="502" viewSourceURL="../files/DataGridExampleCinco.mxml">
    <mx:Script>
    <![CDATA[
    import mx.collections.ArrayCollection;
    import mx.binding.utils.BindingUtils;
    [Bindable]
    private var allGames:ArrayCollection;
    [Bindable]
    private var selectedGames:ArrayCollection;
    private function initDGAllGames():void
    allGames = new ArrayCollection();
    allGames.addItem({name: "World of Warcraft",
    creator: "Blizzard", publisher: "Blizzard"});
    allGames.addItem({name: "Halo",
    creator: "Bungie", publisher: "Microsoft"});
    allGames.addItem({name: "Gears of War",
    creator: "Epic", publisher: "Microsoft"});
    allGames.addItem({name: "City of Heroes",
    creator: "Cryptic Studios", publisher: "NCSoft"});
    allGames.addItem({name: "Doom",
    creator: "id Software", publisher: "id Software"});
    protected function button1_clickHandler(event:MouseEvent):void
    BindingUtils.bindProperty(dgSelectedGames,"dataProvider" ,dgAllGames ,"selectedItems");
    ]]>
    </mx:Script>
    <mx:Label x="11" y="67" text="All our data"/>
    <mx:Label x="10" y="353" text="Selected Data"/>
    <mx:Form x="144" y="10" height="277">
    <mx:DataGrid id="dgAllGames" width="417" height="173"
    creationComplete="{initDGAllGames()}" dataProvider="{allGames}" editable="false">
    <mx:columns>
    <mx:DataGridColumn headerText="Game Name" dataField="name" width="115"/>
    <mx:DataGridColumn headerText="Creator" dataField="creator"/>
    <mx:DataGridColumn headerText="Publisher" dataField="publisher"/>
    </mx:columns>
    </mx:DataGrid>
    <mx:FormItem label="Label">
    <mx:Button label="Move" click="button1_clickHandler(event)"/>
    </mx:FormItem>
    </mx:Form>
    <mx:Form x="120" y="333">
    <mx:DataGrid id="dgSelectedGames" width="417" height="110" >
    <mx:columns>
    <mx:DataGridColumn headerText="Game Name" dataField="name" width="115"/>
    <mx:DataGridColumn headerText="Creator" dataField="creator"/>
    <mx:DataGridColumn headerText="Publisher" dataField="publisher"/>
    </mx:columns>
    </mx:DataGrid>
    </mx:Form>
    </mx:Application>
    Link:
    http://social.msdn.microsoft.com/Forums/en-US/winformsdatacontrols/thread/ae9bee8d-e2ac-43 c5-9b6d-c799d4abb2a3/
    Thanks and Regards,
    Vibhuti Gosavi | [email protected] | www.infocepts.com

Maybe you are looking for

  • Can a thread do more than one thing at once?

    Hey all, I'm confused a little bit on how a thread might act in this situation: I have a server-client setup. The thread on the Client sits and waits to receive instructions from the server. When it does, it manipulates some ArrayLists I have in the

  • Display long Text in PDF (How to match width of text in TextEdit & Form)

    Hello Experts, I have created a PDF where I have to populate a field with Long Text (from a Text Edit UI Element of my Web Dynpro Component). The issue is that when I retrieve the text (using READ_TEXT...) and display it, it occupies just the half of

  • N95 video message help

    I have an N95 8gb but I dont seem to be able to receive video messages. i can receive pictures and sounds but no videos even though they are under 300k. I have been in touch with Vodafone who have said to do the following: 1.On the phone press the Me

  • Importing photos others have uploaded to my web gallery into my library

    My web galleries seem to be working great...a few people have uploaded their own photos and they have synched down to my web galleries. But what is the best way to import my friends' photos into my iPhoto library? I want them to appear in my Events,

  • IPod Touch Home Button Barely Working

    I have a 32GB iPod Touch. I got it in August 2008 and have taken very good care of it since then. Yesterday I noticed that the Home button wasn't working like it used to. I had to really mash it down or hold it down for the home button to respond. Do