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.ChangeListener;
import com.google.gwt.user.client.ui.ListBox;
public class GWTClient implements EntryPoint,ChangeListener {
ListBox list = new ListBox();
public void onModuleLoad() {
list.setVisibleItemCount(10);
list.setMultipleSelect(true);
list.addItem("A");
list.addItem("B");
list.addItem("C");
list.addItem("D");
list.addChangeListener(this);
RootPanel.get().add(list);
}
public void onChange(Widget sender) {
if (sender == list) {
Window.alert(Integer.toString(list.getSelectedIndex()));
}
}
}
|