Rectangle tr = tree.getPathBounds(lastPath); if (tr != null) { Insets i = ((DefaultTextField) editingComponent).getBorder() .getBorderInsets(this); int textIconGap = 3; tr.x -= i.left;
    public void paint(Graphics g)    {      Rectangle tr = tree.getPathBounds(lastPath);      if (tr != null)        {          Insets i = ((DefaultTextField) editingComponent).getBorder()                                                  .getBorderInsets(this);          int textIconGap = 3;          tr.x -= i.left;                    // paints icon          if (editingIcon != null)            {              editingIcon.paintIcon(this, g, tr.x - editingIcon.                                              getIconWidth()/2, tr.y + i.top + i.bottom);              tr.x += editingIcon.getIconWidth()/2 + textIconGap;            }                    tr.width += offset;                    // paint background          g.translate(tr.x, tr.y);          editingComponent.setSize(new Dimension(tr.width, tr.height));          editingComponent.paint(g);          g.translate(-tr.x, -tr.y);        }      super.paint(g);    }