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?

Similar Messages

  • JTextArea on Jtree node

    Hi, I'm sorry but I don't understand how to have a jtextarea or a jtextpane on a jtree node. someone can help me? I's very important, I'm working on a xhtml editor for accessible web pages.
    Thank you

    A JDOM document forms a natural tree structure and I have a TreeModel adapter for this. Creating the adapter to just allow the display of the data is fairly straightforwards but it will require a bit more effort to make an editable adapter. At this time I cannot relase my code.
    If you are going to use DefaultMutableTreeNode then you can build the path of JDOM elements from a node using the DefaultMutableTreeNode.getUserObjectPath() method and then you can cast the items to JDOM elements.

  • 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

  • Help with JTree node handles icon

    Hi
    In my application i use Jtree to display the hirearchical data.But i don't want to the node handles icon to be displayed in the screen.The root node handle icon will be not be displayed if we set jtree.setShowsRootHandles(false) .Is there any way to diable the other node handles icons too?.Please help me in overcoming the problem.
    So, i will be handling the expand/collapse operations of the node with the help of mouse click event.
    Thanks in advance.
    Regards,
    Krish.

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

  • Set different color for one JTree node

    hello,
    I managed to find how to set a color for Jtree nodes but the problem is that with my method all the nodes will b the same color whereas i'm looking to have nodes of different color depending on the situation.
    the method for setting all Jtree nodes the same color(other than black):
    tree.setCellRenderer(
    new DefaultTreeCellRenderer() {
       public Color getTextNonSelectionColor() {
         return Color.lightGray; } });I WANT TO CHOSSE EACH COLOR FOR EACH NODE
    help plz
    thanks

    You need to implement TreeCellRenderer interface
    public Component getTreeCellRendererComponent(JTree tree,
                                                  Object value,
                                                  boolean sel,
                                                  boolean expanded,
                                                  boolean leaf,
                                                  int row,
                                                  boolean hasFocus)You can know which node is rendering by check value argument. Please read DefaultTreeCellRenderer's code.

  • How to get the icon type of a JTree node, very urgent

    hi,
    i need to get the type of a JTree node but don't know how. this is quite an emergency. please help. thank you all.
    -joey

    there are several icons defined in the DefaultTreeCellRenderer class, such as closedIcon, leafIcon, openIcon. i was wondering if there is any way to get the icon type of a node. thanks for your reply.
    -joey

  • 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

  • Multiline text in a jtree node

    i'm not able to add the multiline text in a jtree node. i've checked the data in both the cases before adding into the tree and after adding into the tree. itz getting the data in the proper format. but while displaying inside the tree itz taking into the single line.
    kindly help me to get the data in a multi line format in the jtree.
    thanks in advance.
    import java.awt.*;
    import java.awt.event.*;
    import java.sql.Connection;
    import java.sql.Statement;
    import java.sql.ResultSet;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.tree.*;
    import javax.swing.text.*;
    public class DynamicTreeDemo extends JPanel {
    public static String transactionName=null;
    String p1Name=null;
       public static String duration=null;
        public static final String NEWLINE = System.getProperty("line.separator");
    static String[] arrCorrelatorId={"110","122","129","132","130","136","111","109","131","124","127",null};
    static String[] arrParcorrelatorId={"108","110","122","129","122","130","108","108","109","121","121"};
    static String[] arrtransactionName={"FINT3","FINT17","FINT20","FINT52","FINT21","FINT18","FINT4","FINT3"," FINT31","FINT19","FINT51"};
    public static MutableTreeNode node;
    public static DefaultTreeModel model;
    public static TreePath path;
    public static JTree tree;
    static String[] nodeName={"FINT3_108","FINT17_110","FINT20_122","FINT52_129","FINT21_122","FINT18_110","FINT4_108","FINT3_108"," FINT31_109","FINT19_121","FINT51_121",null};
    public DynamicTreeDemo(JFrame frame) {
    final DynamicTree treePanel = new DynamicTree(transactionName);
    populateTree(treePanel);
    JTextField name = new JTextField(20);
    setLayout(new BorderLayout());
    treePanel.setPreferredSize(new Dimension(300, 150));
    add(treePanel, BorderLayout.CENTER);
    JPanel panel = new JPanel();
    panel.setLayout(new GridLayout(10,50));
    add(panel, BorderLayout.EAST);
    public DefaultMutableTreeNode newObj(String parent){
    DefaultMutableTreeNode pname= new DefaultMutableTreeNode(parent);
    return pname;
    public void populateTree(DynamicTree treePanel)
         String p3;
         DefaultMutableTreeNode p2,nNode, p1;
         int ind=0, i=0,k=0, len=0, m=0;
         boolean flag= false;
         String desc;
         while(nodeName[m]!=null)
         p3 = nodeName[m];
         ind = p3.indexOf("_");
         p3 = p3.substring(0, ind);
           desc=NEWLINE +"hi"+NEWLINE+"how r u";
         if(arrParcorrelatorId[m].equals(arrParcorrelatorId[0]))
                   treePanel.addObject(null, p3,desc);
         else{
              int loopcount=0;
              for(int j=0;nodeName[j]!=null;j++)
                        if(arrParcorrelatorId[m].equals(arrParcorrelatorId[j]))
                             for(int p=0;nodeName[p]!=null;p++)
                                       if(arrCorrelatorId[p].equals(arrParcorrelatorId[j]))
                                            p1=newObj(arrtransactionName[p]);
                                            System.out.println("parent:"+p1);
                                            System.out.println("child:"+p3);
                                            treePanel.addObject(p1, p3,desc);
                                            break;
                        break;
              m++;
    public static void showNodes(String corrId)
         transactionName="FINT3";
    public void DynamicDisplayNode(String corrId){
    JFrame frame = new JFrame("DynamicTreeDemo");
    showNodes(corrId);
    Container contentPane = frame.getContentPane();
    contentPane.setLayout(new GridLayout(1,1));
    contentPane.add(new DynamicTreeDemo(frame));
    frame.addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent e) {
    System.exit(0);
    frame.pack();
    frame.setVisible(true);
    public static void main(String[] args)
    JFrame frame1=null;
    DynamicTreeDemo demo= new DynamicTreeDemo(frame1);
    demo.DynamicDisplayNode("108");
    import java.awt.Color;
    import java.awt.Component;
    import java.awt.Dimension;
    import java.awt.GridLayout;
    import java.util.Enumeration;
    import java.util.StringTokenizer;
    import javax.swing.JScrollPane;
    import javax.swing.JTree;
    import javax.swing.border.Border;
    import javax.swing.border.LineBorder;
    import javax.swing.event.TreeModelEvent;
    import javax.swing.event.TreeModelListener;
    import javax.swing.tree.DefaultMutableTreeNode;
    import javax.swing.tree.DefaultTreeCellRenderer;
    import javax.swing.tree.DefaultTreeModel;
    import javax.swing.*;
    public class DynamicTree extends JPanel  {
        protected DefaultMutableTreeNode rootNode;
        protected DefaultTreeModel treeModel;
        protected JTree tree;
        protected DefaultTreeCellRenderer linksRenderer;
        public static final String NEWLINE = System.getProperty("line.separator");
        public DynamicTree(String appName) {
             rootNode = new DefaultMutableTreeNode(appName);
            treeModel = new DefaultTreeModel(rootNode);
            tree = new JTree(treeModel);
            tree.setEditable(false);
            tree.setShowsRootHandles(true);
            tree.setBackground(Color.white);
            tree.setCellRenderer(new DefaultTreeCellRenderer()
                 public Component getTreeCellRendererComponent(JTree pTree,
                     Object pValue, boolean pIsSelected, boolean pIsExpanded,
                     boolean pIsLeaf, int pRow, boolean pHasFocus)
                       DefaultMutableTreeNode node = (DefaultMutableTreeNode)pValue;
                       JLabel lbl = (JLabel)super.getTreeCellRendererComponent(pTree, pValue, pIsSelected,pIsExpanded, pIsLeaf, pRow, pHasFocus);
                      lbl.setBorder(new LineBorder(Color.RED,1));
                 /* Component c =  super.getTreeCellRendererComponent(pTree, pValue, pIsSelected,
                         pIsExpanded, pIsLeaf, pRow, pHasFocus);
                           if (node.isRoot())
                                          c.setForeground(Color.red);
                          else if (node.getChildCount() > 0)
                                    c.setForeground(Color.blue);
                           else if (pIsLeaf)
                                    c.setForeground(Color.black);//new Color(0x736AFF));*/
                           setBackgroundNonSelectionColor(Color.white);
                           JPanel p = new JPanel();
                           p.setBackground(tree.getBackground());
                           Dimension d = lbl.getPreferredSize();
                           p.setPreferredSize(new Dimension(d.width, d.height));
                           p.add(lbl);
                           tree.setRowHeight(30);
                  return (p);
            JScrollPane scrollPane = new JScrollPane(tree);
            setLayout(new GridLayout(1,0));
            add(scrollPane);
        public void addObject(DefaultMutableTreeNode parent,Object child,String desc)
            child=child+desc;
            //System.out.println("child"+child);
                DefaultMutableTreeNode     parent1;
            DefaultMutableTreeNode childNode =
                    new DefaultMutableTreeNode(child);
              if (parent == null)
                          parent = rootNode;
              else
                   String parentName = (String)parent.getUserObject();
                   String tok;
                   Enumeration e=null;
                   e=(Enumeration) rootNode.breadthFirstEnumeration();
                   int breakloop=0;
                   parent = rootNode.getLastLeaf();
                    while (e.hasMoreElements() ) {
                        if(parent!= null)
                             //System.out.println("parent.toString():"+parent.toString());
                             tok=parent.toString();
                             StringTokenizer st = new StringTokenizer(tok);
                             parent1=newObj(st.nextToken());
                             if(parent1.getUserObject().equals(parentName))
                                       breakloop=1;
                                       break;
                             parent= parent.getPreviousNode();
                   if(breakloop==0)
                        parent = rootNode.getLastLeaf();
              System.out.println("parent.toString():"+parent.toString());
              System.out.println("childNode"+childNode.toString());
              parent.add(childNode);
    public DefaultMutableTreeNode newObj(String parent){
          DefaultMutableTreeNode pname= new DefaultMutableTreeNode(parent);
              return pname;
    class MyTreeModelListener implements TreeModelListener {
            public void treeNodesChanged(TreeModelEvent e) {
                DefaultMutableTreeNode node;
                node = (DefaultMutableTreeNode)
                         (e.getTreePath().getLastPathComponent());
                try {
                    int index = e.getChildIndices()[0];
                    node = (DefaultMutableTreeNode)
                           (node.getChildAt(index));
                } catch (NullPointerException exc) {}
            public void treeNodesInserted(TreeModelEvent e) {
            public void treeNodesRemoved(TreeModelEvent e) {
            public void treeStructureChanged(TreeModelEvent e) {
    }

    Here is a simple example.
    import java.awt.BorderLayout;
    import javax.swing.*;
    import javax.swing.tree.DefaultMutableTreeNode;
    public class MultiLineTreeDemo extends JFrame {
         private JTree tree;
         public static void main( String[] args ) throws Exception {
              SwingUtilities.invokeLater( new Runnable() {
                   public void run() { new MultiLineTreeDemo(); }
         public MultiLineTreeDemo() {
              super( "MultiLineTreeDemo" );
              setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
              DefaultMutableTreeNode root = new DefaultMutableTreeNode( "<html>This is<p>the root node.</html>" );
              DefaultMutableTreeNode node = new DefaultMutableTreeNode( "<html>This is<p>a child node.<html>" );
              root.add( node );
              tree = new JTree( root );
              setLayout( new BorderLayout() );
              JScrollPane scrollPane = new JScrollPane( tree );
              add( scrollPane, BorderLayout.CENTER );
              setSize( 200, 200 );
              setVisible( true );
    }

  • 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

  • Please (some Help)

    Hi, all
    If anyone knows that answer please let me know, beucase I didn't find anywhere
    In CCMS alerts nodes (memory/CPU utilization) setup for auto-re-action, I received alert in lotus notes, but manualy, when I apply
    RZ20 (MTE tree)
    SAP CCMS Monitor Templates --> Dialog Overview --> Entire System --> SID --> Operating system --> Memory --> Free memory
    When I selected free memory and click "OPEN ALERTS"  button it shows
    Free Memory [2 alerts], 105 < 15 MB (with red color) then I received 2 alerts in mail unless I have to go from menu Extras --> Active mantance function then from menu "Edit --> Notes MTE --> Start method --> start auto-reaction method then it show in my lotus notes
    My question is that why is not doing automatically?
    2nd when I fix free memory probelm color become green but when it become red again then number of alers shows 3 alerts?
    I don't know you guys get my point but please some help
    Thanks

    Hi,
    Auto Reaction Method for CCMS Alert
    http://sap.ittoolbox.com/groups/technical-functional/sap-basis/auto-reaction-method-for-ccms-alert-985645#
    Go through this PPT..
    http://h40084.www4.hp.com/events/universe/2006pe/pdfs/technical_tutorial/th-1015-3.pdf
    Thanks,
    Satya Kumar

  • How to sort jTree Nodes

    Hi,
    I am interested in whats the easiest way to sort jTree Nodes alphabetically. Is there any Method to do this directly or may i use something like quicksort?
    Thanks for help
    Mirco

    Thanks Hamed,
    Well, I work in your code, and I post here.
      public static DefaultMutableTreeNode sortTree(DefaultMutableTreeNode root) {
                     for (int i =0; i<root.getChildCount()-1; i++) {
                              DefaultMutableTreeNode node = (DefaultMutableTreeNode) root.getChildAt(i);
                            String nt = node.getUserObject().toString();
                            for (int j=i+1;j<=root.getChildCount()-1;j++)
                                     DefaultMutableTreeNode prevNode = (DefaultMutableTreeNode) root.getChildAt(j);
                                        String np = prevNode.getUserObject().toString();
                                System.out.println(nt+" "+np);
                                if (nt.compareToIgnoreCase(np)>0) {
                                               root.insert(node, j);
                                             root.insert(prevNode, i);
                            if (node.getChildCount() > 0) {
                        node = sortTree(node);
                     return root;
        }and this code I used after include in jtree
      public  void jTreeSortingBegin()
              dn = (DefaultMutableTreeNode)treeModel.getRoot();
              treeModel.reload();
              dn = sortTree(dn);
              treeModel.reload(dn);
        }for exemple
      addObject(jTextField1.getText());
            jTreeSortingBegin();

  • My itunes library is empty but i want to upgrade my ipod without losing my music. how can i do this? please someone HELP!!!

    i recently got a new laptop so my itunes library is empty but i want to upgrade my ipod without losing my music. how can i do this? please someone HELP!!!

    but i got music from my old laptop and my little brothers laptop so basically its no way i can take whats already on my ipod and put it on my computer and drag and drop it to my new itunes library

  • Hey iphone an iphone 3g and i only have about 13 apps and the yellow bar on itunes for my phone is way to big i deleted all my photos all my music every thing i ryed restoring ans all it still takes up space for sum reason ?? please someone help me

    hey iphone an iphone 3g and i only have about 13 apps and the yellow bar on itunes for my phone is way to big i deleted all my photos all my music every thing i ryed restoring ans all it still takes up space for sum reason ?? please someone help me

    If Other (the yellow bar) is too big something is corrupted.  The only solution (that I know of) is to restore from your most recent backup using iTunes (see http://support.apple.com/kb/ht1766).

  • Setup problem please anyone help ~~ me !!!

    i was trying to setup adobe photoshop and i clicked setup.exe (file picture display like as a white paper) and it told me to choose application. so i dont know how to change or choose which program .. please anyone help me out on this..

    Photoshop is an application that must be purchased (not available via a download) and isn't cheap.
    You must purchase the OS X (Tiger compatible) version of Photoshop.
    Check Apple's online store under software or do a Google search.

  • My phone 5s did the new update and will not come back on. I already tried hard reboot still won't work. Been over a hour now. Please someone help I need my phone.

    My phone 5s 16gb gold did the new update and will not come back on. I already tried hard reboot still won't work. Been over a hour now. Please someone help I need my phone.   This phone is not even 6 months old been in case no scratches. This is driving me crazy.

    Connect your phone to a computer and restore your software using iTunes.

Maybe you are looking for

  • How many computers can i use with creative cloud?

    how many computers can i use with creative cloud?

  • Flashing black screen when pasting?

    I have a student that when she pasted some image (jpg) and text elements from  from one indesign cs4 document to another the indesign window would flash black then part of what she was pasting would appear. Then it would flash black again and the res

  • Referencing values in Array Collection?

    I'm using a Remote Object to pass an argument to a CFC. I then query a table according to the value of the argument passed in ('where' clause). I return a single record result as a query in Flex (event.result) and set it as an Array Collection, examp

  • Display result Group wise

    Hello experts, Update type is key in report. It has two values. 1000 & 2000. I want to display result after displaying all the values of 1000. same for 2000 values. Ex: 1000    ICICI     100            HDFC   200            SBI      300 Result       

  • Using MM-SUS create invoice can't change price

    Dear All,    We used MM-SUS create invoice,we want to change the item price,how to do it?