Why JTree node display text with uncomplete word with ...

Some nodes with short word, for example Header, display uncompletely with ..., while some nodes display text with complete word which has more letters, for example Substation.
Why?

If you need further help then you need to create a "Short, Self Contained, Compilable and Executable, Example Program (SSCCE)",
see http://homepage1.nifty.com/algafield/sscce.html,
that demonstrates the incorrect behaviour, because I can't guess exactly what you are doing based on the information provided.
Don't forget to use the "Code Formatting Tags",
see http://forum.java.sun.com/help.jspa?sec=formatting,
so the posted code retains its original formatting.

Similar Messages

  • Why can't I text with non Apple equipment?

    Why can't I text with non Apple equipment?

    You can with third party apps. You just can't use Messages in order to text since it only works with other iOS devices and Macs running Mountain Lion.
    https://www.google.com/search?q=texting%20apps%20for%20iPad

  • Why does Youtube display text in Chinese?

    Youtube pages viewed in Firefox (36.0.1) on my Mac Mini running OSX 10.9.5 display some, but not all, of the text in Chinese. Pages display correctly in Safari and Chrome. I have reinstalled and refreshed Firefox with no change.
    Changing View/Character Encoding to Western changes the display to English characters, but the words are gibberish.
    See attached screenshots.

    It is the second screenshot that shows the wrong encoding.
    I missed that that screenshot was when you switched to Western, so that is to be expected.
    Clear the cache and remove cookies only from websites that cause problems.
    "Clear the Cache":
    *Firefox > Preferences > Advanced > Network > Cached Web Content: "Clear Now"
    "Remove Cookies" from sites causing problems:
    *Firefox > Preferences > Privacy > "Use custom settings for history" > Cookies: "Show Cookies"

  • Unable to display text with image in a cell of web dynpro table.

    Hello,
    I am unable to display an image with the text inside a cell of web dynpro table. The image doesn't come at all. I am trying to display the image of an object and the object description alongside within the same cell.
    Thanks and Regards,
    Abhijnan

    Hi
    Pls check the below link
    http://help.sap.com/saphelp_nw70ehp2/helpdata/en/9b/46bb0d339b42cc8d30636ca0c9f5b6/frameset.htm
    The only problem is only the below UI elements are supported
    ■Button
    ■ToggleButton
    ■LinkToUrl
    ■LinkToAction
    ■FileDownload

  • Displaying text without breaking words..

    Hi,
    i am printing a text on a sap script using the
    field :BSEG-SGTXT. this is of length 50 characters.
    i am printing it on 2 lines of 25 characters each.
    is there any way / function module to ensure that
    the words dont get cut while the text is bieng
    displayed on 2 lines..?
    Rgds
    Ravindra

    Hi,
    you can try this way...
    : BSEG-SGTXT+0(25)
    : BSEG-SGTXT+25(50).
    Regards
    vijay

  • On my Mac, why do websites display differently with FireFox than Safari.

    I have been using FireFox on my Mac and prefer it over Safari, BUT recently, some, not all, websites are not displaying correctly! When I use Safari all the content is there and the websites display as they are supposed to. (I tried to insert a screen shot but unable to do so) I have the most current FF version installed, unless FireFox is not happy with my older MAC OS ??

    Thank you for the info!! Attached are a few screenshots to show the problem - I now know how to do a screen shot! thx.... anyway note on the Ancestry shot Safari shows a male or female head whereas Firefox show a simple symbol for male/female. I spoke with Ancestry and it is supposed to be the male/female head icons that are displayed. In the Yahoo shot Safair displays the icons and names for reply, delete etc but Firefox has some icon that only if you hover over it will it then display the name or what it is. this is very perplexing as I really prefer Firefox over Safari... any help will be appreciated! thank you

  • Why can't we text with the phone horizontal?

    It is far easier to use the keyboard that way, so why isn't there an option to do so? COME ON APPLE!

    As this is a users forum, populated by iphone users - like yourself - not Apple, it is hard for us to tell you why Apple chooses to support the functions that they do.
    If you would like to leave feedback for Apple you may do so at:
    www.apple.com/feedback/iphone.html

  • How is display text with superscript.

    hi expert.
    PBO:
    set titlebar 'zhr'.
    title code = zhr.
    titlebar name = Titan with tm>superscript.-> how??
    how is prepared for it???
    Reply me immediately,
    Thx,
    S.Suresh.

    hi Kodandarami Reddy.S,
    donot use se71
    only use se38.
    PBO: set title bar 'zh1'.
    click as zh1 then title code name = zh1.
    title name = titan with tm-> Superscript> How??
    How is assigned for it?
    Reply me immediately,
    S.Suresh.

  • What is the best way to display text?

    Hi,
    I am developing a full screen presentation. I like to know which is the best way to display text with different styles and fonts.
    When i use JLabel, i have to use HTML. But the presentation is not good as it does not have anti-alias property. Also i want the background to be seen behind the text. Note that all the text in a paragraph is not of same style. I want some words to be in different color and style.
    Thanks,
    Mathan

    It works alos with JTextPane:
    Try this :
    import java.awt.*;
    import javax.swing.*;
    public class MyTextPane extends JTextPane  {
         public void paintComponent(Graphics g) {
              Graphics2D g2d = (Graphics2D)g;          
              g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);          
              super.paintComponent(g2d);
         public static void main(String[] args) {
              JFrame f = new JFrame("test");
              f.getContentPane().add(new JScrollPane(new MyTextPane()));
              f.setBounds(200,200,300,400);
              f.setVisible(true);
    }Denis

  • Excel & Word file don't display text after 10.6.4 update

    Installed 10.6.4 update last week on an iMac and the cells within my excel sheets went blank. The data is still there but do not show up on screen. Tried several variation of start up and even reinstalled Office only for problem to exist still. New documents will display text but most of my existing office documents appear blank.
    So... Today I reinstalled snow leopard and my text was back & displaying until I ran the OS updates. Every thing was fine until 10.6.4 and poof!!! there went my text in office. This glitch even effects some existing word documents. Graphic, images and pdf's don't seem to be effected. Any body else having this problem?
    Just dumb founded....

    I've been experiencing the same issue. I upgraded to 10.6.4 and I lost several fonts. The interesting thing is I also lost several power point images I had created. Shapes and lines were missing even though they did not involve the offending fonts, at least not directly. There was text elsewhere in the image that used it. Why this should obliterate the rest of the images I don't know.
    The three offending Fonts for me were:
    1) Times New Roman
    2) Arial
    3) Brush Script MT
    Anywho, I managed to fix this on my machine so I'm posting how I did it here. I'm not so sure as to the why, but here it goes.
    On my machine I have 4 font folders
    1) -> System -> Library -> Fonts
    2) -> Library -> Fonts
    3) -> Users -> Me -> Library -> Fonts
    4) -> Applications -> Office X -> Office -> Fonts (yes, I'm still running Office X from 2000)
    Inside of the Font Book application, it was kind enough to point out I had duplicate fonts. Some of these were the fonts in question and others caused me no troubles. Go figure. Anyway, disabling one or the other of the duplicate fonts did not fix the problem.
    Here's what did, though. In my case the duplicate fonts existed in the second of the font directories above (henceforth referred to as Font2) and the third of the font directories listed above (Font3). I browsed to these directories and copied the fonts to my desktop to have a back up. Back in Font Book, I told it to remove each instance of the Arial and Times New Roman fonts that would not display correctly in Excel (for the moment, I left Brush Script MT alone, kind of like a control)
    Now at this point there were no Arial or Times New Roman fonts in my Font Book. Turns out they were removed from Font1, Font2 and Font3, so good thing I have a backup.
    1) Opened up Excel. It did its font menu optimization thing and sure enough, I couldn't see anything.
    2) I close Excel.
    3) I double clicked on Times New Roman that I had in Font4. Font Book opened it and I chose to install it. It put it in my Font3 directory.
    4) I opened up Excel. It did its font menu optimization thing. Suddenly I can see Times New Roman again!
    5) I close Excel.
    6) I double click on the Arial Font from my Font4 directory. Font Book opens it and I install it to my Font3 directory.
    7) I open Excel, it does its font menu optimization thing and suddenly I can see Arial!
    8) I close Excel.
    Now at this point I'm wondering if my old font files got corrupted and because I was installing using the ones from my Font4 directory (which avoids the system directly) I was getting them back. So to test, I told Font Book to remove Times New Roman again, I go through the test of opening and confirming in Excel, and then I install the Times New Roman font from my desktop that I had copied out of the Font2 directory. Everything works fine in Excel. So it's not the file that was bad.
    I was also wondering if I needed to remove all instances of the fonts or if just one was causing the trouble. So I go back to Font Book and remove the instance of Brush Script MT that was in my Font3 directory. When I opened Excel I still couldn't see anything.
    I reinstalled the copy of Brush Script MT from the desktop and tried removing the other instance of the font, the one from the Font2 Directory. Excel still shows nothing. I then reinstall the associated font file from the desktop. Excel still doesn't like me.
    Finally, I removed all instances of Brush Script MT and installed at random one of them from the desktop. Suddenly Excel likes it.
    So I don't know what the problem was, maybe an associated was bad, but either way the only way I could get my fonts back was to remove all instances of the bad fonts from Font Book and then install the font again.
    In between removing and installing I would go into Excel where it would refresh its Font list at startup. Not sure if this had anything to do with it either.
    All my fonts now display correctly and all my powerpoint drawn images show up as well. I hope this helps someone else!
    -Kevin

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

  • Why i have to delete the Current word Text if i type wrong Previous word text in the sentence, my fingers are broad cannot accurately point the specific character, I am forced to delete current word text, its really making my mind to get rid of  iPhone4.

    Why i have to delete the Current word Text if i type wrong Previousword text in the sentence, my fingers are broad cannot accurately point thespecific character, I am forced to delete current word text, its really makingmy mind to get rid of  iPhone4.

    Hold your finger on the word for a little time - after a second or so, a magnifying view appears showing the few letters around your finger, with a cursor. Roll your finger to move the cursor to just in front of the letter you want to fix. Then let your finger go. You can now backspace to delete and replace the incorrect letter.

  • 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

  • Issue with displaying text in BEx

    Hi all,
    We are facing an issue with displaying text in the query output.
    We have a master data carrying charac ' 0MATERIAL'.When i do maintain master data ,I am able to see medium description in the output.
    Now when i drag 0MATERIAL in bex designer and in properties set display to key and text(medium text), it shows me only the key and it shows some wierd text which is in no way related to the medium description ( that was shown under maintain master data)
    can anyone pls tell me why i am not able to see the medium description when executing the query that too when the text is loaded.
    Pls help
    Regards,
    Suchitra

    But what i wouldlike to know is what about the master data which is present in 0MATERIAL now?
    Nothing will happen to your data.
    Its showing there ...dosent that mean its present and activated?
    They are present n in active version.
    If u change any records they will be in M version..by activating the data...u are converting it to A version.
    Regards,
    Ram.

  • JTree problem displaying nodes

    I have created a GUI, in which part of it allows the user to view files in a selected folder in a JTree format.
    The tree only shows selected files with certain extensions (such as ".txt", ".doc", etc.. see code below)
    I'll try to show what it looks like, for example:
    - RootFolder
        - SomeOpenFolder
            - someFile
            - anotherFile
        + SomeClosedFolder
        - File_in_RootFolder
        - Another_file_in_RootFolder Anyhow, when I shipped it to my boss he occasionally cannot view the full file names..
    for example:
    - RootFolder
        - SomeOp....
            - some....
            - anothe...
        + SomeClo...
        - File_in_R...
        - Another_fil...I have the JTree inside a JScrollPane with horizontalScrollBarPolicy set to "AS_NEEDED"
    I have run several tests, with both LONG and SHORT names... and it all works just fine for me
    For example:
    - RootFolder
        - SomeOpenFolder
            - someFile
            - anotherFile_With_A_VERY_VERY_VERY_VERY_LOOOOOOOOOOOOOOOOOOOONG_NAME
        + SomeClosedFolder_With_A_VERY_VERY_VERY_VERY_LOOOONG_NAME
        - File_in_RootFolder
        - Another_file_in_RootFolder And i am able to scroll left&right to view the full name within the scroll panel.
    But for some reason, on my Bosses computer sometimes it has the full name,
    and other times it cuts the name short with "FolderNa..."
    Is anyone aware of why such a problem could happen?
    Here is my code setting up the tree.
    public void setMyTree(String myFolder)
    File rootFile = new File(myFolder);
            JTree targetTree = new JTree(TreeSetup(rootFile, InputIncludeFilter()));
            targetTree.getSelectionModel().setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION);
            targetTree.setCellRenderer(new TreeCellRenderer() {
                  public Component getTreeCellRendererComponent(JTree tree, Object value,
                                boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) {
                      JLabel label = new JLabel(value.toString());
                      TreePath p = tree.getPathForRow(row);
                      if(p != null){
                          File node = getInputFile(p);                    
                      if (selected) {
                             label.setOpaque(true);
                             label.setBackground(tree.getBackground().darker());
                          return label;
                  private File getInputFile(TreePath path) {
                      StringBuffer fName = new StringBuffer();
                        boolean isroot = true;
                        for (Object s : path.getPath()) {
                                  fName.append(s + File.separator);                          
                      return new File(getUserDomain()+File.separator +
                                 fName.toString().substring(0, fName.toString().length() - 1));
    }Any ideas? Do would it help to see my method "InputIncludeFilter()"

    DefaultTreeCellRenderer extends from JLabel, so whatever you are doing to the JLabel you create you can do to the DefaultTreeCellRenderer too.
    This would be more like it:
           targetTree.setCellRenderer(new DefaultTreeCellRenderer() {
                  public Component getTreeCellRendererComponent(JTree tree, Object value,
                                boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus)
                     super.getTreeCellRendererComponent(tree,value,selected,expanded,leaf,row,hasFocus);
                      TreePath p = tree.getPathForRow(row);
                      if(p != null){
                          File node = getInputFile(p);                    
                      if (selected) {
                             this.setOpaque(true);
                             this.setBackground(tree.getBackground().darker());
                          return this;
                  }

Maybe you are looking for