Changing JTree node text results in "..."

I'm working with a JTree, and I have a problem if I change the text displayed on a node. After changing the node, I call nodeChanged( node ) on the tree model.
What happens is that if the new text on the node is longer than the previous one, the text is cut short and the end replaced by "...". E.g. if the old text was "foo" and the new is "foobar", it turns out as "foo...". This happens even if there is more than enough space in the tree to hold the complete new name, e.g other nodes in the same column with longer names.
I guess somehow, the tree doesn't properly correct the layout of the cell to accomodate the longer text. I feel it is a bug, since I use the proper calls on the tree model to notify of the change.

nodeStructureChanged() will give the exact same behavior.
A solution is to use SwingUtilities.invokeLater().
    SwingUtilities.invokeLater(new Runnable(){
      public void run(){model.nodeChanged(node);}
    });

Similar Messages

  • JTree - node text doesn't fit when shown with icon

    When I start off my JTree with a long string text for the node (without any icon...used setLeafIcon( null )... it displays fine. But during the execution of hte program an icon may appear next to a particular node - but when this happens, the icon displays fine and the text of the node is cut off (you just see a couple letters followed by the usual "...").
    Any ideas?

    Thanks for the reply. I am not sure how to use that for what I'm doing...basically I am writing an AIM clone. And when a user sets an away message, I want an icon to appear next to their name, otherwise the icon is set to null. Here is the code I have right now for my tree cell renderer class (the tree class is a basic tree):
    import javax.swing.*;
    import javax.swing.event.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.tree.*;
    import javax.swing.text.*;
    import java.util.*;
    import java.io.*;
    class MyTreeCellRenderer extends DefaultTreeCellRenderer {
         * Handle to the ClientTree.
        ClientTree clientTreeObj;
         * Constructor.
        public MyTreeCellRenderer( ClientTree ct ) {
            clientTreeObj = ct;
         * Gets the cell renderer for the current object
         * in the tree.
        public Component getTreeCellRendererComponent(
            JTree tree,
            Object value,
            boolean sel,
            boolean expanded,
            boolean leaf,
            int row,
            boolean hasFocus) {
        super.getTreeCellRendererComponent(
            tree, value, sel,
            expanded, leaf, row,
            hasFocus);
        // if we are at the root, take away the icons and set
        // the appropriate font.
        if (!leaf) {
            setClosedIcon( null );
            setOpenIcon( null );
            setToolTipText( null );
            setFont( new Font( "SansSerif", Font.BOLD, 14 ) );
        // we are at a leaf, so set the tooltip to be the username and
        // set the appropriate font.
        else {
            // make sure we are not at the "Users" node
            if ( !value.toString().equals( "Users" ) ) {
                // if the client has an away message, set the icon to a note icon
                if ( clientTreeObj.getJCC().getClientAwayMessage( value.toString() ).length() > 0 ) {
                    System.out.println( value.toString() + ": has a message..." );
                    setLeafIcon( new ImageIcon( "C:/JavaChat/JavaClient/images/message.jpg" ) );
                    ((DefaultTreeModel)tree.getModel()).nodeChanged((DefaultMutableTreeNode)tree.getPathForRow(row).getLastPathComponent() );
                    //tree.fireTreeExpanded( tree.getPathForRow( row ) );
                else {
                    setLeafIcon( null );
                    //tree.fireTreeExpanded( tree.getPathForRow( row ) );
                // get the connection time for the selected user
                // I TOOK OUT THE CODE TO CALCULATE THE TIME BECAUSE IT IS UNIMPORTANT AND LONG :)
                // set the tooltiptext to include the username and the online time
                String tooltip = " " + value.toString() + '\n' + "   Online time:" + '\t';
                    // days
                    if ( days > 0 ) {
                        if ( days == 1 )
                            tooltip += days + " day, ";
                        else
                            tooltip += days + " days, ";
                    // hours
                    if ( hours > 0 ) {
                        if ( hours == 1 )
                            tooltip += hours + " hour, ";
                        else
                            tooltip += hours + " hours, ";
                    // minutes (we always print at least 1)
                    if ( minutes > 1 )
                        tooltip += minutes + " minutes ";
                    else
                        tooltip += minutes + " minute ";
                    setToolTipText( tooltip );
                    setFont( new Font( "SansSerif", Font.PLAIN, 14 ) );
            return this;
        } // end getTreeCellRendererComponent
    } // end class MyRenderer

  • Change JTree Node Color

    Hi,
    I set the background of a JTree to orange color by:
    jTree1.setBackground(Color.orange);
    However, the space around text is still in white color. Can anyone tell me how to change it too? Thanks.

    Hi, you could try -
    ((JComponent)
    yourTree.getCellRenderer()).setOpaque(false);
    I've not actually tested this, I'm just in the process
    of figuring out the details of using trees.
    colinThanks. It works with "yourTree.getCellRenderer()).setOpaque(true);"

  • How to change JTree nodes background?

    hello there
    i have a jtree which i set its background to red
    but the nodes background is still white
    why?and how to set the nodes background to red too?
    and how to remove the tree border
    because i tried setting it to null and it doesn't work?
    here is my code:
    package view;
    import java.awt.Color;
    import javax.swing.*;
    import javax.swing.tree.*;
    class TreeComponent{
      public static void main(String[] args) {
        JFrame frame = new JFrame("Creating a JTree Component!");
        DefaultMutableTreeNode parent = new DefaultMutableTreeNode("Color", true);
        DefaultMutableTreeNode black = new DefaultMutableTreeNode("Black");
        DefaultMutableTreeNode blue = new DefaultMutableTreeNode("Blue");
        DefaultMutableTreeNode nBlue = new DefaultMutableTreeNode("Navy Blue");
        DefaultMutableTreeNode dBlue = new DefaultMutableTreeNode("Dark Blue");
        DefaultMutableTreeNode green = new DefaultMutableTreeNode("Green");
        DefaultMutableTreeNode white = new DefaultMutableTreeNode("White");
        parent.add(black);
        parent.add(blue);
        blue.add(nBlue);
        blue.add(dBlue);
        parent.add(green );
        parent.add(white);
        JTree tree = new JTree(parent);
        tree.setBackground(Color.red);
        tree.setBorder(null);
        frame.add(tree);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setUndecorated(true);
        frame.getRootPane().setWindowDecorationStyle(JRootPane.PLAIN_DIALOG);
        frame.setSize(200,200);
        frame.setVisible(true);
    }

    how to set the nodes background to red too?
    ((JComponent) tree.getCellRenderer()).setOpaque(true);[/code\
    how to remove the tree borderWhat border?
    db                                                                                                                                                                                                                                                                                                                                       

  • Changing the Jtree node value

    hi,
    I have created a JTree node and i want to change the nodes string.
    say for example from "child1" to "newchild1". Only the text displayed on the tree shoud be changed and the new value is got from a text box.
    uma

    You can change the value of a path using valueForPathChanged of the TreeModel:
    tree.getModel().valueForPathChanged(path, str);

  • 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 );
    }

  • Changes in the Text element of Bex Analyzer result Informaton tab

    Hi Expert,
    How can we make changes in the display of the Text element of the query result in the Information tab and save it? For eg. The User wants to display STATUS OF DATA TO rather than STATUS OF DATA in the Information tab of the query result.
    The query is based on Multiprovider so it has Text Element of STATUS OF DATA
    In the Workbook its easy to do, how do we do the changes in the query result in Analyzer and save it, so it always displays the chosen text element?
    I dont want to create a workbook for the query, so is there any way to replace any of the Text Element with another existing standard Text element.

    Hi Ray,
    Thanks for your reply.
    The change is required in the Text element of information tab (once query is displayed there are buttons for Graph, Information), so the changes are required there for the text element and  not for Characterstics and KF.

  • Change of variable text in BEx selection screen

    Hi all,
    in our BW system the key users are allowed to create queries and also create variables. In some cases, especially for often used info objects like 0DATE the number of variables is increasing very quickly. The reason for this is, that 0DATE is used for a big variety of meanings e.g. delivery date, order date, invoice date etc.
    So the users always create new variables only to have a meaningful description in the BEx selection screen, because they do not want only "date" to be displayed here. As result we have many different varianbles with exactly the same technical settings with only different names.
    So my question is: Is it possible to change the diplayed text in the selection screen for each query without having to create a new variable?
    Thanek you and best regards

    Hi Stephan,
    Changing the diplayed text in the selection screen for each query is not possible.You have to create a new variable for each query.
    Rgds,
    Murali

  • E-mail changes to unreadable text when moved to another mailbox folder

    Hi,
    when moving a correct received e-mail to another mailbox folder, the mail and the attachment will change to unreadable text and it looks like the column below.
    On my iPad and iPhone the mail and the attachment is shown correct. If I forward it to my own account again, the mail is also correct shown an my imac27, as long as it resides in the in-box.
    On the other hand, there are lots of mails+attachments with "normal" behavier when moved.
    Any idea about that?
    mackliko
    ------=_NextPart_000_0001_01CCF256.3C7DD310
    Content-Type: multipart/alternative;
              boundary="----=_NextPart_001_0002_01CCF256.3C7DD310"
    ------=_NextPart_001_0002_01CCF256.3C7DD310
    Content-Type: text/plain;
              charset="us-ascii"
    Content-Transfer-Encoding: 7bit
    ------=_NextPart_001_0002_01CCF256.3C7DD310
    Content-Type: text/html;
              charset="us-ascii"
    Content-Transfer-Encoding: quoted-printable
    <html xmlns:v=3D"urn:schemas-microsoft-com:vml" =
    xmlns:o=3D"urn:schemas-microsoft-com:office:office" =
    xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
    xmlns:m=3D"http://schemas.microsoft.com/office/2004/12/omml" =
    xmlns=3D"http://www.w3.org/TR/REC-html40">
    <head>
    <META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
    charset=3Dus-ascii">
    <meta name=3DGenerator content=3D"Microsoft Word 12 (filtered medium)">
    <style>
    <!--
    /* Font Definitions */
    @font-face
              {font-family:"Cambria Math";
              panose-1:2 4 5 3 5 4 6 3 2 4;}
    @font-face
              {font-family:Calibri;
              panose-1:2 15 5 2 2 2 4 3 2 4;}
    /* Style Definitions */
    p.MsoNormal, li.MsoNormal, div.MsoNormal
              {margin:0cm;
              margin-bottom:.0001pt;
              font-size:11.0pt;
              font-family:"Calibri","sans-serif";}
    a:link, span.MsoHyperlink
              {mso-style-priority:99;
              color:blue;
              text-decoration:underline;}
    a:visited, span.MsoHyperlinkFollowed
              {mso-style-priority:99;
              color:purple;
              text-decoration:underline;}
    span.E-MailFormatvorlage17
              {mso-style-type:personal-compose;
              font-family:"Calibri","sans-serif";
              color:windowtext;}
    .MsoChpDefault
              {mso-style-type:export-only;}
    @page Section1
              {size:612.0pt 792.0pt;
              margin:70.85pt 70.85pt 2.0cm 70.85pt;}
    div.Section1
              {page:Section1;}
    -->
    </style>
    <!--[if gte mso 9]><xml>
    <o:shapedefaults v:ext=3D"edit" spidmax=3D"1026" />
    </xml><![endif]--><!--[if gte mso 9]><xml>
    <o:shapelayout v:ext=3D"edit">
    <o:idmap v:ext=3D"edit" data=3D"1" />
    </o:shapelayout></xml><![endif]-->
    </head>
    <body lang=3DDE-AT link=3Dblue vlink=3Dpurple>
    <div class="3DSection1">
    <p class="3DMsoNormal">Mfg<o:p></o:p></p>
    <p class="3DMsoNormal">Martin lanzinger<o:p></o:p></p>
    <p class="3DMsoNormal"><o:p> </o:p></p>
    </div>
    </body>
    </html>
    ------=_NextPart_001_0002_01CCF256.3C7DD310--
    ------=_NextPart_000_0001_01CCF256.3C7DD310
    Content-Type: application/pdf;
              name="Test.pdf"
    Content-Transfer-Encoding: base64
    Content-Disposition: attachment;
              filename="Test.pdf"

    Please run /cleanviews switch to check the result.
    (Type "Outlook.exe /cleanviews in Windows search bar and press ENTER.)
    Please also create a new Outlook profile to check if the issue still persists. Thanks.
    Tony Chen
    TechNet Community Support

  • 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.

  • How to change the answer text within the review widget of iBooks Author?

    I want to change the answer text which appears after one has finished a test within the review widget of iBooks Author, but I can't figuere out how to do that.
    I also want to sum up the result of a couple of questions as a percentage. How does that work?
    Can anybody help?
    Thanks
    Reinhard

    Notice the answers inside the widget, each with a circle to the left - tap on one of those, which will then appear green with a checkmark in the center to indicate the correct choice.

  • How to change the Short text of a GUI Status .

    Hi Guys ,
       Can any one guide me on how to change the short text of an already existing GUI Status .
    I have already tried doing these :Opened the GUI Status in change mode and changed the short texts of the Application tool bar ,
                               Menu Bar ,
                               Function Keys ,
    thinking that this will update in the Short text .. but that didnt happen ...
    Below is what I need ...
    Requirement :
    GUI Status : Status_001 .
    Short Text :  New GUI Status .
    Change the Short Text to " Changed GUI Status ' . 
    Regards,
    Ranjita

    Hi Ranjita,
    Do this...
    go to SE80
    Open the program.. open node GUI Status
    Double click on the status you want to change
    go to menu GOTO>ATTRIBUTES>STATUS
    click on continue or simply enter
    Here change the short text and continue or enter
    activate it
    Hope this helps..
    Regards,
    Kinshuk

  • Can I change the standard text for web item 'INFO_FIELD_ITEM'?

    Hello experts.
    I made a WAD template using web item 'INFO_FIELD_ITEM'.  In data binding, I used the 'Last refresh' of general text elements.   As a result, in the web browser I can see the last update date & time. (e.g. 'Last refresh: 2007.01.17 17:34:44') Then our customer want to change the default text "Last refresh" as "Working time".
    How can I change this?
    I tried to change the text symbols for program SAPLRRSV. But it worked only in Bex Analyzer not in the web.
    Our server version is Netweaver 2004s and SP10.
    Best regards.
    JY Park.

    Hello,
    I had the same problem - just wanted to display the values of a variable in an info-field, but not the caption.
    I found out, that there's a tag for Info-Field Item called ONLY_VALUES (it's the checkbox under the headers visible checkbox in the properties dialog of the Info-Field Item; in my WAD version, there's no label assigned to this checkbox, so it was not easy to find out what it should be),
    You have to set it to 'X' (check it) ; then you get the unformatted value of the variable (no caption anymore).
    <bi:INFO_FIELD_ITEM name="INFO_FIELD_ITEM_1" designheight="500" designwidth="350" >  <bi:WIDTH value="350" />
    <bi:HEIGHT value="500" />
    <bi:DATA_PROVIDER_REF value="DP_1" />
    <bi:HEADERS_VISIBLE value="" />
    <bi:ONLY_VALUES value="X" />
    You have to insert the info-field item between span tags so that you can define your own formatting values.
    The ONLY_VALUES tag works the same as the tag 'RENDER_AS_TEXT' you have with the text item , see
    http://help.sap.com/saphelp_nw70/helpdata/en/e3/e60138fede083de10000009b38f8cf/frameset.htm
    There's only one disadvantage: If you have chosen a lot of variable values (multiple selection), the variable string gets very long and no line break is performed, because all blanks in the string are replaced by nbsp's. I solved this with a little Java Script, replacing the appropriate nbsp-s with br tags.
    Hope it helps
    Beate

  • 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

  • Changing Certain Node Icons

    I can't seem to figure out how to change certain node icons in a JTree due to a 3 letter string. For example 2 nodes one saying "Intro" the other say "Edit - SEC" - the one with SEC has a different icon to "Intro"
    MyRenderer class, here the code which is used to check the string of the node......
    if(leaf && isSecuredFile(value)) {
    setLeafIcon(leafSecuredIcon);
    setToolTipText("This file is Secured Access Only");
    else {
    setToolTipText(null);
    return this;
    protected boolean isSecuredFile(Object value) {
    DefaultMutableTreeNode node = (DefaultMutableTreeNode)value;
    NodeRecord nodeInfo = (NodeRecord)(node.getUserObject());
    String nodeTitle = nodeInfo.NodeRecord;
    if(nodeTitle.indexOf("SEC") >= 0) {
    return true;
    return false;
    }// MyRenderer class
    I tried the above piece of code, and it compiles with no errors but when I try to run the applet it comes up not initialised with the following....
    java.lang.NoClassDefFoundError: MyRenderer
    at firstPanel.<init>(firstPanel.java:99)
    at JNavigator.jInit(JNavigator.java:55)
    at JNavigator.init(JNavigator.java:40)
    at sun.applet.AppletPanel.run(AppletPanel.java:344)
    at java.lang.Thread.run(Thread.java:484)
    However if I take out this code it works fine but I need to be able to assign different icons depending on the node title string. Therefore I need help.

    here's the whole class, if thats any help...
    public class MyRenderer extends DefaultTreeCellRenderer {
    ImageIcon leafIcon;
    ImageIcon leafSecuredIcon;
    public MyRenderer() {
    leafIcon = new ImageIcon("Leaf.gif");
    leafSecuredIcon = new ImageIcon("LeafSecured.gif");
    public Component getTreeCellRendererComponent(JTree tree, Object val, boolean sel, boolean expand, boolean leaf, int row, boolean hasFocus) {
    super.getTreeCellRendererComponent(tree, val, sel, expand, leaf, row, hasFocus);
    // sets Icons
    setLeafIcon(leafIcon);
    setClosedIcon(new ImageIcon("Folder95C.gif"));
    setOpenIcon(new ImageIcon("Folder95O.gif"));
    // set Expansion icons to + -
    ComponentUI treeUI = tree.getUI();
    if(treeUI instanceof BasicTreeUI) {
    ((BasicTreeUI)treeUI).setExpandedIcon(new ImageIcon("minus.gif"));
    ((BasicTreeUI)treeUI).setCollapsedIcon(new ImageIcon("plus.gif"));
    // decides who icon to use
    if(leaf && isSecuredFile(value)) {
    setLeafIcon(leafSecuredIcon);
    setToolTipText("This file is Secured Access Only");
    else {
    setToolTipText(null);
    return this;
    protected boolean isSecuredFile(Object value) {
    DefaultMutableTreeNode node = (DefaultMutableTreeNode)value;
    NodeRecord nodeInfo = (NodeRecord)(node.getUserObject());
    String nodeTitle = nodeInfo.NodeRecord;
    if(nodeTitle.indexOf("DOM") >= 0) {
    return true;
    return false;
    }

Maybe you are looking for

  • Aperture 3.3.2 and Mountain Lion

    Aperture crashes in Mountain Lion when trying to do multiple processes.  I get multi windows, photos then have to reboot I re-installed Aperture 3.3.2 with updates, Still crashes when doing more then one thing. I have a macbook pro 15" 2.66 core 2 du

  • Running COBOL programs from java

    I am on a project at the moment where we want the client-server to be written in Java on Solaris Sparc UNIX machines. The thing is we want the server to start a COBOL program and the output from the COBOL program will be the reply to the client. Is t

  • Photoshop elements 4 on a ibook g4 running 10.5.8 (not intel)

    after upgrading to 10.5.8 i have discovered my photoshop 7 program, which i have used for yrs, will not run on this op system.  i am looking for the correct version of adobe photoshop elements to buy for an non-intel computer running mac os 10.5.8...

  • Move itunes account from one computer to another

    My laptop recently died and I bought a rerplacement. I have installed itunes on the new machine. When I log on to my account none of my music, videos, podcasts or photos are showing. How do I access these on a new machine?

  • MacBook pro Keyboard not working after coffee spillage. Possible replacement?

    Hi there, 4 days ago I spilled coffee (nescafe with sugar, no milk) over my Macbook (mid 2012 non-retina). I turned it off instantly and I've put it upside down. Then I opened it and I started to dry the notebook. I had few attempts to turn on over t