Buggy code:
} else { if ( ! getText ) rect . right = rect . left ; } } if ( ( fullText || fullImage ) || clip ) { if ( hwndHeader != 0 ) { RECT headerRect = new RECT ( ) ; if ( columnCount != 0 ) { if ( ( OS . SendMessage ( hwndHeader , HDM_GETITEMRECT , index , headerRect ) ) == 0 ) { return new RECT ( ) ; } } else { headerRect . right = parent . scrollWidth ; if ( ( headerRect . right ) == 0 ) headerRect = rect ; } if ( fullText ) rect . right = headerRect . right ; if ( fullImage ) rect . left = headerRect . left ; if ( clip && ( ( headerRect . right ) < ( rect . right ) ) ) { rect . right = headerRect . right ; } } } } else { if ( ! ( ( 0 <= index ) && ( index < columnCount ) ) ) return new RECT ( ) ; RECT headerRect = new RECT ( ) ; if ( ( OS . SendMessage ( hwndHeader , HDM_GETITEMRECT , index , headerRect ) ) == 0 ) { return new RECT ( ) ; } rect . left = handle ; if ( ( OS . SendMessage ( hwnd , TVM_GETITEMRECT , 0 , rect ) ) == 0 ) { return new RECT ( ) ; } rect . left = headerRect . left ; if ( fullText ) { rect . right = headerRect . right ; } else { rect . right = headerRect . left ; Image image = null ; if ( index == 0 ) { image = this . image ; } else { if ( ( images ) != null ) image = images [ index ] ; } if ( image != null ) { Point size = parent . getImageSize ( ) ; rect . right += size . x ; } if ( getText ) { String string = ( index == 0 ) ? text : ( strings ) != null ? strings [ index ] : null ; if ( string != null ) { RECT textRect = new RECT ( ) ; TCHAR buffer = new TCHAR ( parent . getCodePage ( ) , string , false ) ; int flags = ( ( OS . DT_NOPREFIX ) | ( OS . DT_SINGLELINE ) ) | ( OS . DT_CALCRECT ) ; int hNewDC = hDC ; int hFont = 0 ; if ( hDC == 0 ) { hNewDC = OS . GetDC ( hwnd ) ; hFont = ( ( cellFont ) != null ) ? cellFont [ index ] : - 1 ; if ( hFont == ( - 1 ) ) hFont = font ; if ( hFont == ( - 1 ) ) hFont = OS . SendMessage ( hwnd , WM_GETFONT , 0 , 0 ) ; hFont = OS . SelectObject ( hNewDC , hFont ) ; } OS . DrawText ( hNewDC , buffer , buffer . length ( ) , textRect , flags ) ; if ( hDC == 0 ) { OS . SelectObject ( hNewDC , hFont ) ; OS . ReleaseDC ( hwnd , hNewDC ) ; } if ( getImage ) { rect . right += ( ( textRect . right ) - ( textRect . left ) ) + ( ( Tree . INSET ) * 3 ) ; } else { rect . left = ( rect . right ) + ( Tree . INSET ) ; rect . right = ( ( rect . left ) + ( ( textRect . right ) - ( textRect . left ) ) ) + ( Tree . INSET ) ; } } } if ( clip && ( ( headerRect . right ) < ( rect . right ) ) ) { rect . right = headerRect . right ; } } } <START_BUG> int gridWidth = ( parent . getLinesVisible ( ) ) ? Tree . GRID_WIDTH : 0 ; <END_BUG> if ( getText || ( ! getImage ) ) { rect . right = Math . max ( rect . left , ( ( rect . right ) - gridWidth ) ) ; } rect . bottom = Math . max ( rect . top , ( ( rect . bottom ) - gridWidth ) ) ; return rect ; } public boolean getChecked ( ) { } public boolean getExpanded ( ) { } public Font getFont ( ) { } public Font getFont ( int index ) { } public Color getForeground ( ) { } public Color getForeground ( int index ) { } public boolean getGrayed ( ) { } public TreeItem getItem ( int index ) { } public int getItemCount ( ) { } public TreeItem [ ] getItems ( ) { } public Image getImage ( ) { } public Image getImage ( int index ) { } public Rectangle getImageBounds ( int index ) { } public Tree getParent ( ) { } public TreeItem getParentItem ( ) { } public String getText ( ) { } public String getText ( int index ) { } public int indexOf ( TreeItem item ) { } void redraw ( ) { } void redraw ( int column , boolean drawText , boolean drawImage ) { } void releaseChildren ( boolean destroy ) { } void releaseHandle ( ) { } void releaseWidget ( ) { } public void removeAll ( ) { } public void setBackground ( Color color ) { } public void setBackground ( int index , Color color ) { } public void setChecked ( boolean checked ) { }

Fix:
int gridWidth = ( parent . linesVisible ) ? Tree . GRID_WIDTH : 0 ;