Tree cell renderer shows (...) for long texts

I know that the BasicTreeUI saves a cache but I don't know how to reset this cache, or if there is another solution
Best regards
Dekel

My tree is inside jscrollpane.Ok, then I don't understand why your renderer truncates the displayed text.
how can I set the jlabel prefered size to be in the
exact width of the String ?AFAIK, this is the default behavior, i.e. you do not do anything.
(I don't want to see a gap between the label and the end of the
string when a node is selected)Uhm, I have no idea what "gap" you are talking about. I don't see any "gaps" when I select nodes in a JTree.

Similar Messages

  • Tree Cell Renderer settings for displaying complete text.

    I have a tree model. It is of the form
    abc (123.00)
    -----def (456.00)
    ----------ghi (678.00)
    But it is displayed like
    abc (12...
    -----def (45..
    ----------ghi (67..
    I don't want the numbers in the end to be missing. It is a problem for the user to expand them everytime.
    I am using, JTree and using my cell renderer, with following properties in
    super.getTreeCellRendererComponent(tree, false, X, false, false, row, false);I did try to change it to
    super.getTreeCellRendererComponent(tree, false, X, TRUE, false, row, false);but still no success.
    My function toString() for tree elements looks like this
                     double u = "123.00";
                     String num = String.format("%.2f", u);
                     return getName() + " (" + num  + ")";Can you please suggest possible way around for this?

    package abc;
    import java.awt.BorderLayout;
    import java.awt.Dimension;
    import java.awt.event.MouseEvent;
    import java.awt.event.MouseListener;
    import javax.swing.JScrollPane;
    import javax.swing.JTree;
    import javax.swing.WindowConstants;
    import javax.swing.JFrame;
    import javax.swing.tree.DefaultMutableTreeNode;
    import javax.swing.tree.DefaultTreeModel;
    import javax.swing.tree.TreeSelectionModel;
    public class NewJPanel extends javax.swing.JPanel implements MouseListener {
         public static void main(String[] args) {
              JFrame frame = new JFrame();
              frame.getContentPane().add(new NewJPanel());
              frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
              frame.pack();
              frame.setVisible(true);
         JTree m_tree;
        private JScrollPane myPane;
        float multi = 1;
        DefaultTreeModel tree = new DefaultTreeModel(new ContainerNode("root"));
        DefaultMutableTreeNode parent = (DefaultMutableTreeNode)tree.getRoot();
         public NewJPanel() {
            super(new BorderLayout());
            String util = String.format("%.2f", 123456789012345679801234567980.00);
            util = "abc" + " (" + util  + ")";
                DefaultMutableTreeNode e = new DefaultMutableTreeNode(util);
                tree.insertNodeInto(e, parent, 0);
            m_tree = new JTree(tree);
            m_tree.setEditable(false);
            m_tree.setDragEnabled(false);
            m_tree.getSelectionModel().setSelectionMode(TreeSelectionModel.CONTIGUOUS_TREE_SELECTION);
            m_tree.setAutoscrolls(true);
            m_tree.setPreferredSize(new java.awt.Dimension(397, 297));
            myPane = new JScrollPane(m_tree);
            myPane.setAutoscrolls(true);
            myPane.getVerticalScrollBar().setAutoscrolls(true);
            add(myPane, BorderLayout.CENTER);
            m_tree.addMouseListener(this);
              initGUI();
         private void initGUI() {
              try {
                   setPreferredSize(new Dimension(400, 300));
              } catch (Exception e) {
                   e.printStackTrace();
         public void mouseClicked(MouseEvent e) {
              String util = String.format("%f", 6546464642345679801234567980.00 * multi);
            util = "abc" + " (" + util  + ")";
            DefaultMutableTreeNode child = (DefaultMutableTreeNode) parent.getChildAt(0);
            child.setUserObject(util);
            m_tree.repaint();
         public void mouseEntered(MouseEvent e) {}
         public void mouseExited(MouseEvent e) {}
         public void mousePressed(MouseEvent e) {}
         public void mouseReleased(MouseEvent e) {}
    class ContainerNode extends DefaultMutableTreeNode
        private static final long serialVersionUID = 14;
        ContainerNode(String s)
        { super(s); }
    }Executing this code... clicking in the panel, changes the number.
    The new number is displayed as (65464646423456798000000000.000.......
    My problem is nearly similar, except that in my code I am using, String.format("%.2f", 6546464642345679801234567980.00 * multi);
    and still I get (65...)

  • How to display multiple JComponents in a tree cell renderer

    I have an object in a tree cell renderer and want to display its members(three members) status in a JTree as checkboxes such that each node displays three checkboxex with member-names and a node name. i tried using a JPanel and adding three labels into this panel to be returned for the cell renderer but the GUI fails to paint the node componnents. However on clicking the node the component which isn't visible displays correctly. please Help me out

    Since you didn't provide any sample code, it's all about wild guesses on what your problem is. The following code shows the type of program you could have posted :import javax.swing.*;
    import javax.swing.tree.*;
    import java.awt.*;
    public class TestTree extends JPanel {
         private static class MyCell {
              String theCellName;
              boolean theFirstField;
              boolean theSecondField;
              boolean theThirdField;
              public MyCell(String aName, boolean firstField, boolean secondField, boolean thirdField) {
                   theCellName = aName;
                   theFirstField = firstField;
                   theSecondField = secondField;
                   theThirdField = thirdField;
         private static class MyTreeCellRenderer extends JPanel implements TreeCellRenderer {
              private JLabel theCellNameLabel;
              private JCheckBox theFirstCheckBox;
              private JCheckBox theSecondCheckBox;
              private JCheckBox theThirdCheckBox;
              private DefaultTreeCellRenderer theDelegate;
              public MyTreeCellRenderer() {
                   super(new GridLayout(4, 1));
                   theCellNameLabel = new JLabel();
                   add(theCellNameLabel);
                   theFirstCheckBox = new JCheckBox("firstField");
                   add(theFirstCheckBox);
                   theSecondCheckBox = new JCheckBox("secondField");
                   add(theSecondCheckBox);
                   theThirdCheckBox = new JCheckBox("thirdField");
                   add(theThirdCheckBox);
                   theDelegate = new DefaultTreeCellRenderer();
                   setOpaque(true);
              public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected,
                                                                       boolean expanded, boolean leaf, int row, boolean hasFocus) {
                   if (!(value instanceof DefaultMutableTreeNode)) {
                        return theDelegate.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, hasFocus);
                   Object userObject = ((DefaultMutableTreeNode)value).getUserObject();
                   if (!(userObject instanceof MyCell)) {
                        return theDelegate.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, hasFocus);
                   setBackground(tree.getBackground());
                   if (selected) {
                        setBorder(BorderFactory.createLineBorder(Color.BLUE, 2));
                   } else {
                        setBorder(BorderFactory.createLineBorder(getBackground(), 2));
                   MyCell cell = (MyCell)userObject;
                   theCellNameLabel.setText(cell.theCellName);
                   theFirstCheckBox.setSelected(cell.theFirstField);
                   theSecondCheckBox.setSelected(cell.theSecondField);
                   theThirdCheckBox.setSelected(cell.theThirdField);
                   return this;
              public Component add(Component comp) {
                   if (comp instanceof JComponent) {
                        ((JComponent)comp).setOpaque(false);
                   return super.add(comp);
         public TestTree() {
              super(new BorderLayout());
              JTree tree = new JTree(createModel());
              tree.setShowsRootHandles(true);
              tree.setCellRenderer(new MyTreeCellRenderer());
              add(new JScrollPane(tree), BorderLayout.CENTER);
         private static final TreeModel createModel() {
              DefaultMutableTreeNode root = new DefaultMutableTreeNode(new MyCell("root", true, true, true));
              DefaultMutableTreeNode child1 = new DefaultMutableTreeNode(new MyCell("child1", false, true, false));
              DefaultMutableTreeNode child2 = new DefaultMutableTreeNode(new MyCell("child2", false, false, true));
              root.add(child1);
              root.add(child2);
              return new DefaultTreeModel(root);
         public static void main(String[] args) {
              final JFrame frame = new JFrame("Test");
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              frame.setContentPane(new TestTree());
              SwingUtilities.invokeLater(new Runnable() {
                   public void run() {
                        frame.setSize(600, 400);
                        frame.show();
    }

  • How to make single column scrollable in ALV report (for long Text)

    I have a 20 columns which we need to display in ALV grid, including one column for long text. In long text column currently it showing 40 character. I tried to change output length of field catalog but it's not working.
    Can any one help me ....
    Thanks
    Guru
    Message was edited by:
            gurusharan mandal

    hi,
    pls remeove if u give like this in the layout.
    gd_layout-colwidth_optimize = 'X'.
    rgds
    Anver

  • Table for Long Texts of MICs in Tasklist

    Dear All
    Can any body tell me from which SAP table i can get the LONG TEXT maintained for MICs in any tasklist.
    Table PLMK only shows wether long text maintained or not, but i want the value in LONG TEXT.
    thanks
    Zeeshan

    This may be helpful.
    SAP stores comments (text fields) in a separate table. STXH is the text
    "header" table (STXD SAPscript text file header). STXH-TDOBJECT =
    'KNA1' will bring back all the customer comment headers. STXH-
    TDNAME='0000010744' is the header record for the comment for customer
    10744.
    It is not always so simple to figure out what the TDOBJECT (object needed by function below - sometimes it is a table name, other times...), TDNAME (name needed by function below - sometimes it is a document number & line item or customer number, other times... ) & TDID (id needed by function below - it is always the long text id). There are several methods that can be used. You can create the long text that you are researching and using, SE16 for table STXH search TDLUSER = to your kerberos principal and TDLDATE = to today's date. This is modify date & user. Alternatively, you can find an existing item with the long text and figure out the date and user who last modified it and use this information in your search. Once you have STXH row for text of interest, use ZCAFTXT to test your research. Project Titles and WBS Titles are a bit more complex.
    Changes to sales contract long text between 3.0F and 4.5B.
    The following code is a function that will return a customer comment.
    form get_comment using cur_kunnr.
      call function 'READ_TEXT'
           exporting
                id                      = '0002'
                language                = sy-langu
                object                  = 'KNA1'
                name                    = cur_kunnr
           importing
                header                  = thead
           tables
                lines                   = tlinetab
           exceptions
                id                      = 1
                language                = 2
                name                    = 3
                not_found               = 4
                object                  = 5
                reference_check         = 6
                wrong_access_to_archive = 7
                others                  = 8.
      if sy-subrc = 0.
        loop at tlinetab.
          write / tlinetab-tdline.
          add 1 to line_cnt.
        endloop.
      endif.
    endform.
    The above subroutine is called with the following code:
    if p_cmnt = 'X'.
       tdname = cur_cust-kunnr.
       perform get_comment using tdname.
    endif.
    These data elements are defined as:
    data: begin of tlinetab occurs 100.    "table to process comments
            include structure tline.
    data: end of tlinetab.
    data: tdname           like thead-tdname.
    Vishal Jonnalwar

  • Text Area for long text not appearing properly for BBP_POC_DISPLAY Service

    Hi,
    In our development we have added additional Icon at ITS in Process PO transaction and onclicking  that icon Web dynpro AB screen called with the Purchase Order No of selected row .(SRM 5.0)
    There is one more icon in Web dynpro screen on click of that Purchase order service open in ITS with display mode .This is achieved with service BBP_POC_DISPLAY from Web Dynpro-AB.
    This is also working ok only the issue is in Document tab of PO The Text Area for long text appear at Top  .This functionality is working fine with BBP_POC  service from ITS .
    Has anybody faced this kind of issue ?
    Thanks,
    SMS

    Hi SMS,
    I am unsure of the additional component you are talking about. In general, issues with text area misplacing, is solved by note 1067625. May be you can check it.
    thanks,
    Ashwin

  • Change Pointer /Change documents for long text

    Hi,
    I wanted to know if we need to do some settings for activating change documents for long text.Presently in WAK2 (retail) when ever i change long text i cant see any change documents for it(though for rest feilds i can see that).When i looked at oss i saw some notes like 849348(around other transactions) which says that change documents are possible for long text. I wanted to know what steps we need to follow to activate it for this transaction.

    Hi lucky,
    I am facing the same problem. Can you please let me know the solution you have used?
    Thanks in advance for your help.
    Navin

  • Using BSP text editor for long text formatting

    Hello,
    We are using CRM 7.0. We want to perform simple formatting for the long texts (bold, fonts etc.) We are considering to use thtmlbx <btf:btf> element for text editing. The question is how is it possible to save the formatted text as the long text? Is there any standard way to perform it?
    Thanks in advance,
    Sergey

    Hello,
    In the CRM system there are standard views that display long texts connected to the objects. They are stored in the standard tables and not in the ztables. I just want to enable formatting for this text, to store it formatted in the system and next time the user opens the object to show him the formatted text.
    Thanks in advance,
    Sergey

  • Remove symbol # for long text in document line item

    Dear Experts,
    I enter some information in the long text field in document line item. For the area that I use "Tab" button, system will display as # symbol. Therefore when we print the information, the output will include the #### symbol which is not correct.
    Please help.
    Thanks.
    -Syaban-

    Dear Gaurav Aggarwal,
    Thanks for the reply, can you guide me the step to perform the suggested solutions? currently, we are using ECC6.
    Thanks.
    syaban

  • Default values for long text for mic in inspection plan

    hi,
    Some long text are coming default when i am creating inpection plan for mic.
    This is coming for only particular plant. For other plant it is not coming. Is there anywhere we can make it as default for a particualar line item . ie for particular characteristics i.e 10, 20 etc
    sathish. R

    Hi,
    I am not sure , whether you are mentioning about Long text for MIC or Default insp char number (10,20,30..) in the insp plan.
    If you are talking about Insp char number in the insp plan . you can specify the same in SPRO , QM->Q planning ->Insp planning -> General -> Maintain profiles for default values.
    Regards
    K.M.Arun

  • Text table for long text of product catalog area and product description

    Hi experts,
    I'm a new comer in CRM, what my current job is to do the translation for CRM system and its portal, e.g. webshop.  Now I met some questions as below, Could you please give me some advices?
    1. Long text for product catalog area (t-code: COMM_PCAT_ADM; Product Catalog: PCSHOP)
    I found a  table named STXL(STXD SAPscript text file lines), maybe, it is related to the long text(product catalog area), but I can not get anything from the field CLUSTD of the table STXL as  its data type is RAW. Maybe, there is a text table in CRM to store these long text information, but I dont know, Could you please give me some ideas?
    2. Long text for product description (t-code: COMM_PCAT_ADM; Product Catalog: PCSHOP)
    I found a table named COMM_CFGLNGTXT(Long Texts for Different Objects),  I can find some long texts(product description) in this table, but some others, I can not find them. I dont know why? Maybe it is not a correct text table. Could you please give me some advices?
    Thank you very much.
    Quanyin

    Hi Uwe,
    Implement the BADI DOC_PERSONALIZE_BCS and use method PERSONALIZE_DOCUMENT. In this method therz an parameter FLT_VAL, this can be used to derive the description.
    Award points if its useful....
    Regards,
    B Raju

  • Using paragraph format for long text...

    Hello,
    When I try to print the long text using include then
    it starts printing from the very first line.
    But I want to use some paragraph format for it. How can I use it because I am using
    /: INCLUDE '200007200000100' OBJECT AUFK ID KOPF
    So where do I mention the paragraph format in the tag column becaue I am already using /: controll command in font of the include ?

    Check this thread...
    SAPScript - Standard Text
    It looks like the PARAGRAPH P2 statement can do that declaration, on the subsequent line.
    This website also has some good examples:
    http://www.henrikfrank.dk/abapexamples/SapScript/symbols.htm
    Cheers,
    John

  • How to get text name text object and text id for long text

    Hi,
    I am trying to fetch Long text for a given order number from transaction CO04 in SAPScript. I know that I have to use Include X (OBJECT) XX ID XXX.
    How do I get the text name, text object and text id for the order header long text from Transaction CO04.
    Points will be awarded..
    Tushar

    Tushar,
    When you are in CO02, and are at the Long Text Tab,click on the Icon that is next to the Order Number at the top of the screen (this icon looks like a Pencil and a Pad of Paper and is called "Change Long Text"). When you click on this it will take you to the SAPscript Editor. Now hit Goto->Header and you will get the data you require.
    Hope this helps.
    Cheers,
    Pat.
    PS. Kindly award Reward Points as appropriate.

  • GR Page headers empty for 1st page for Long Text greated than 26 lines

    Gurus,
    I have this wierd problem on my GR. I added the following code and corresponding fetches in the printprogram to include PO Item long texts in the GR.
    /: INCLUDE &T166P-TXNAM& OBJECT &T166P-TDOBJECT& ID &T166P-TDID& LANGUAGE E PARAGRAPH Z8 NEW-PARAGRAPH Z8 
    When the text is upto 26 lines, everything seems fine. But when it is more than 26 lines and usually a new page needs to be created, all the dynamic texts like PO number, Buyer name, Plant name etc. in the header of the 1st page is blank. But all the details in the second page seem to apprear fine.
    Any suggestions on where to or what to look for to solve this problem?
    I'd appreciate any help with this problem.
    Thanks
    L

    Yes...the way the current print program works is that the header and footer contains information like PO number dat, buyer, isuued by etc and these will print on each page that is created. These are populated prior to the area where write forms for Main are issued.
    The main page contains the Item related information. I have added a code where the long text is also obtained before all the write forms. I then issue write form in the same subroutine where other Main-related write forms are coded.
    L

  • Tree Cell Renderer

    is there anyone who knows or can point me to some explanation
    on how to place a background image inside the tree??
    i'm trying to place different images for in behind the text
    and icons for each state, open and close.
    any info would be appreciated.
    thanks...

    You will need to specify an itemRenderer for your tree.
    Probably the easiest thing to do is to create an Actionscript
    itemRenderer that extends the current TreeItemRenderer. In your
    renderer, you can override the updateDisplayList function to allow
    for a background image depending on your data.
    Here is a skeleton of what your itemRenderer might look like:
    package
    import mx.controls.treeClasses.*;
    import mx.collections.*;
    public class MyTreeItemRenderer extends TreeItemRenderer
    public function MyTreeItemRenderer()
    super();
    override protected function
    updateDisplayList(unscaledWidth:Number,
    unscaledHeight:Number):void
    super.updateDisplayList(unscaledWidth, unscaledHeight);
    if(super.data)
    //Add your code here to add an image to the background of
    this item

Maybe you are looking for

  • Error during creation of asset.

    Hello, when i am creating an asset for a certain asset class, i am getting an error popup which reads 'Customizing inconsistency - missing/incorrect entry in table T093B'.The depreciation area associated with the asset class has been created by copy

  • Regarding opening balance of vendor

    we have a vendor which total balance on the date 03.11.2011 is Rs.15000000. But what is the requirement is now with the same vendor we should have opening balance on dated 01.04.2011 is Rs.100000. is this possible?(to put this amount as opening balan

  • Registering reports into EBS

    Hi everybody, I am trying to register a rdf file into Oracle EBS but I get some error.which its log is at below: Application Object Library: Version : 12.0.0 Copyright (c) 1979, 1999, Oracle Corporation. All rights reserved. ZMIGREGHRPASANDAZ module:

  • Notebook reliably locks up completely - cold restart required

    I have a Fujitsu P7120 notebook. I bought it used several years ago and I love it, despite its age. It was very reliable and stable...but a bit slow. I decided to upgrade the stock 4400RPM drive with an SSD (http://www.kingspec.com/solid-state-dis -

  • Apple Certified Tech grasping at Straws iMac 24" 8,1

    I have a 2.8 GHZ 24" 8,1 version iMac sitting on my bench.   This one has the upgraded video card 8800, 512k that was something like $800 new. Always Kernel Panics on startup just as the gear stops and the screen ordinarily goes to blue. Doesn't matt