GWT ListBOx change text padding

399 views Asked by At

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

1

There are 1 answers

1
Prasanth Np On

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

listBox.setWidth("10px");