SwingListbox extends AbstractSwingContainer implements XulListbox, ListSelectionListener { public void setSelectedItems( Object[] items ) { int[] indices = new int[items.length]; int index = -1; for ( Object object : items ) { indices[++index] = model.indexOf( object ); } setSelectedIndices( indices ); } SwingListbox( Element self, XulComponent parent, XulDomContainer container, String tagName ); Object getManagedObject(); boolean isDisabled(); void setDisabled( boolean disabled ); void setDisabled( String disabled ); int getRows(); void setRows( int rowsToDisplay ); String getSeltype(); void setSeltype( String selType ); Orient getOrientation(); void layout(); String getOnselect(); void setOnselect( String onchange ); void valueChanged( ListSelectionEvent e ); Object getSelectedItem(); Object[] getSelectedItems(); void setSelectedItem( Object item ); void setSelectedItems( Object[] items ); void setSelectedIndices( int[] indices ); void addItem( Object item ); void removeItems(); int getRowCount(); int getSelectedIndex(); int[] getSelectedIndices(); void setSelectedindex( String idx ); void setSelectedIndex( int index ); Collection<T> getElements(); void setElements( Collection<T> elements ); String getBinding(); void setBinding( String binding ); String getCommand(); void setCommand( final String command );  }
@Test public void testSetSelectedItems() throws Exception { assertEquals( 1, list.getSelectedIndex() ); list.setSeltype( "multiple" ); XulListitem item2 = (XulListitem) doc.getElementById( "listItem2" ); XulListitem item1 = (XulListitem) doc.getElementById( "listItem1" ); Object[] items = new Object[] { item2, item1 }; list.setSelectedItems( items ); Object[] selected = list.getSelectedItems(); assertEquals( item1, selected[0] ); assertEquals( item2, selected[1] ); }