int textIconGap = 4; Rectangle vr = new Rectangle(); Rectangle ir = new Rectangle(); Rectangle tr = new Rectangle();  FontMetrics fm = editingComponent.getToolkit().getFontMetrics(getFont()); SwingUtilities.layoutCompoundLabel(((JComponent) editingComponent), fm, ((JTextField) editingComponent).getText(), editingIcon, JTextField.LEFT, JTextField.LEFT, JTextField.LEFT, JTextField.LEFT, vr, ir, tr, 4);  Rectangle cr = tr.union(ir); cr.width += offset;   if (DefaultTreeCellEditor.this.editingIcon != null) DefaultTreeCellEditor.this.editingIcon.paintIcon(DefaultTreeCellEditor. this.editingComponent, g, cr.x, cr.y);
Rectangle tr = tree.getPathBounds(lastPath); if (tr != null) { Insets i = ((DefaultTextField) editingComponent).getBorder() .getBorderInsets(this); int textIconGap = 3; tr.x -= i.left;   if (editingIcon != null) { editingIcon.paintIcon(this, g, tr.x - editingIcon. getIconWidth()/2, tr.y + i.top + i.bottom); tr.x += editingIcon.getIconWidth()/2 + textIconGap; }
    public void paint(Graphics g)    {      int textIconGap = 4; // default value      Rectangle vr = new Rectangle();      Rectangle ir = new Rectangle();      Rectangle tr = new Rectangle();            FontMetrics fm = editingComponent.getToolkit().getFontMetrics(getFont());      SwingUtilities.layoutCompoundLabel(((JComponent) editingComponent), fm,           ((JTextField) editingComponent).getText(), editingIcon,           JTextField.LEFT, JTextField.LEFT, JTextField.LEFT, JTextField.LEFT,            vr, ir, tr, 4);                  Rectangle cr = tr.union(ir);      cr.width += offset;            // paint icon      if (DefaultTreeCellEditor.this.editingIcon != null)        DefaultTreeCellEditor.this.editingIcon.paintIcon(DefaultTreeCellEditor.                                        this.editingComponent, g, cr.x, cr.y);      super.paint(g);      (new CellRendererPane()).paintComponent(g, editingComponent, this, cr);    }