public ListBoxDiscrete(ImageResource up, ImageResource down) { this.up = up; this.down = down; img = new ImageButton(down, "Select..."); HorizontalPanel panel = new HorizontalPanel(); panel.add(label); panel.add(img); initWidget(panel); setStylePrimaryName("SelectButton"); img.addClickHandler(this); label.addClickHandler(this); listTable.addChangeHandler( new ChangeHandler() { @Override public void onChange(ChangeEvent event) { if (popup != null) popup.hide(); label.setText(texts.get(listTable.getSelected())); } }); }
public void addChangeHandler(ChangeHandler handler) { listTable.addChangeHandler(handler); }