Buggy code:
public class AutoCompleteTextField extends TextField { private Container popup ; private boolean dontCalcSize = false ; private FilterProxyListModel < String > filter ; private ActionListener listener = new AutoCompleteTextField . FormPointerListener ( ) ; private ListCellRenderer completionRenderer ; private ArrayList < ActionListener > listeners = new ArrayList < ActionListener > ( ) ; private String pickedText ; private int minimumLength ; public AutoCompleteTextField ( String [ ] completion ) { } public AutoCompleteTextField ( ListModel < String > listModel ) { } public AutoCompleteTextField ( ) { } @ Override protected void initComponent ( ) { } @ Override protected void deinitialize ( ) { } void setParentText ( String text ) { } @ Override public void setText ( String text ) { } protected void updateFilterList ( ) { } protected boolean filter ( String text ) { } private boolean filterImpl ( String text ) { } protected ListModel < String > getSuggestionModel ( ) { } public void setCompletionRenderer ( ListCellRenderer completionRenderer ) { } public void keyPressed ( int k ) { } public void keyReleased ( int k ) { } private void removePopup ( ) { } public void addListListener ( ActionListener a ) { } public void removeListListener ( ActionListener a ) { } private void addPopup ( ) { final Form f = getComponentForm ( ) ; popup . removeAll ( ) ; popup . setVisible ( false ) ; popup . setEnabled ( false ) ; filter ( getText ( ) ) ; final com . codename1 . ui . List l = new com . codename1 . ui . List ( getSuggestionModel ( ) ) ; l . setScrollToSelected ( false ) ; l . setItemGap ( 0 ) ; for ( ActionListener al : listeners ) { l . addActionListener ( al ) ; } if ( ( completionRenderer ) == null ) { ( ( DefaultListCellRenderer < String > ) ( l . getRenderer ( ) ) ) . setShowNumbers ( false ) ; } else { l . setRenderer ( completionRenderer ) ; } l . setUIID ( "AutoCompleteList" ) ; l . addActionListener ( new ActionListener ( ) { public void actionPerformed ( ActionEvent evt ) { pickedText = ( ( String ) ( l . getSelectedItem ( ) ) ) ; setParentText ( pickedText ) ; if ( Display . getInstance ( ) . isTextEditing ( AutoCompleteTextField . this ) ) { Display . getInstance ( ) . editString ( AutoCompleteTextField . this , getMaxSize ( ) , getConstraint ( ) , ( ( String ) ( l . getSelectedItem ( ) ) ) ) ; } popup . setVisible ( false ) ; popup . setEnabled ( false ) ; f . repaint ( ) ; } } ) ; byte [ ] units = popup . getStyle ( ) . getMarginUnit ( ) ; if ( units != null ) { units [ Component . LEFT ] = Style . UNIT_TYPE_PIXELS ; units [ Component . TOP ] = Style . UNIT_TYPE_PIXELS ; popup . getStyle ( ) . setMarginUnit ( units ) ; } popup . getUnselectedStyle ( ) . setMargin ( LEFT , Math . max ( 0 , getAbsoluteX ( ) ) ) ; popup . getSelectedStyle ( ) . setMargin ( LEFT , Math . max ( 0 , getAbsoluteX ( ) ) ) ; int y = getAbsoluteY ( ) ; int topMargin ; int popupHeight ; <START_BUG> int listHeight = ( filter . getUnderlying ( ) . getSize ( ) ) * ( l . getElementSize ( false , true ) . getHeight ( ) ) ; <END_BUG> if ( y < ( ( f . getContentPane ( ) . getHeight ( ) ) // 2 ) ) { topMargin = ( y - ( f . getTitleArea ( ) . getHeight ( ) ) ) + ( getHeight ( ) ) ; popupHeight = Math . min ( listHeight , ( ( f . getContentPane ( ) . getHeight ( ) ) // 2 ) ) ; } else { popupHeight = Math . min ( listHeight , ( ( f . getContentPane ( ) . getHeight ( ) ) // 2 ) ) ; popupHeight = Math . min ( popupHeight , ( y - ( f . getTitleArea ( ) . getHeight ( ) ) ) ) ; topMargin = ( y - ( f . getTitleArea ( ) . getHeight ( ) ) ) - popupHeight ; } popup . getUnselectedStyle ( ) . setMargin ( TOP , Math . max ( 0 , topMargin ) ) ; popup . getSelectedStyle ( ) . setMargin ( TOP , Math . max ( 0 , topMargin ) ) ; popup . setPreferredH ( popupHeight ) ; popup . setPreferredW ( getWidth ( ) ) ; popup . setHeight ( popupHeight ) ; popup . setWidth ( getWidth ( ) ) ; popup . addComponent ( l ) ; popup . layoutContainer ( ) ; dontCalcSize = true ; if ( f != null ) { if ( ( popup . getParent ( ) ) == null ) { f . getLayeredPane ( ) . addComponent ( popup ) ; } f . revalidate ( ) ; } } public int getMinimumLength ( ) { } public void setMinimumLength ( int minimumLength ) { } class FormPointerListener implements ActionListener { public void actionPerformed ( ActionEvent evt ) { } } public String [ ] getPropertyNames ( ) { } public Class [ ] getPropertyTypes ( ) { } public String [ ] getPropertyTypeNames ( ) { } public Object getPropertyValue ( String name ) { } public String setPropertyValue ( String name , Object value ) { } public boolean isStartsWithMode ( ) { } public void setStartsWithMode ( boolean startsWithMode ) { } }

Fix:
int listHeight = ( l . getModel ( ) . getSize ( ) ) * ( l . getElementSize ( false , true ) . getHeight ( ) ) ;