0

I am using GWT's ListBox to let user select their input from a list of items. When the listboxes are display in my browser (Chrome) there seems to be a rather large space between the end of the word and the end of the listbox itself.

For example:

enter image description here

This is the code i use to add the listbox to a FlexTable:

    final ListBox listBox = new ListBox();
    listBox.setVisibleItemCount(1);
    listBox.addItem("");
    listBox.setEnabled(enabled);
    listBox.setSelectedIndex(selectedIndex);
    setWidget(1, columnIndex, listBox);
    getFlexCellFormatter().setStylePrimaryName(1, columnIndex, cellStyle);

What can I do to remove the extra space between the end of the word and end of the list box?

Thanks

jonatzin
  • 922
  • 1
  • 13
  • 30
  • Is there a stylesheet that is configured for the select option. It looks like either you have padding set or the other option is that one of your options in the list is very long. The select will always expand to the longest option. There are work arounds for this such as text-overflow but I would check these first. – Chris Hinshaw Aug 12 '14 at 17:20
  • This the stylesheet involved (according to FireBug) body { color:#333333; font-family:'Helvetica Neue', Helvetica, Arial, sans-serif; font-size:14px; line-height:20px; }. The values aren't very long either. what are the work arounds – jonatzin Aug 13 '14 at 12:28

1 Answers1

0

set width to your listBox. or use Chosen list box: http://jdramaix.github.io/gwtchosen/ and set width.

listBox.setWidth("10px");
Prasanth Np
  • 175
  • 6