Add item to ListBox : ListBox « GWT « Java






Add item to ListBox


package com.java2s.gwt.client;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.ClickListener;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.Widget;
import com.google.gwt.user.client.ui.ListBox;

public class GWTClient implements EntryPoint {

  public void onModuleLoad() {
    ListBox list = new ListBox();
    list.setVisibleItemCount(1);
    for (int i = 0; i < 10; ++i) {
      list.addItem("list item " + i);
    }

    RootPanel.get().add(list);
  }
}


           
       








GWT-addItemToListBox.zip( 2 k)

Related examples in the same category

1.ListBox with multiple selection