I have 200 items in my list and all the items show up on the screen. But, I want only to have 10 items to be visible and then have vertical scrollbar. How do I achieve this? I tried setting the bounds but that did not work. I'm using SWT inside eclipse forms. Below is my code. Any suggestions?
final Label myLabel = this.toolkit_.createLabel(myComposite, "Label: ", SWT.BEGINNING);
gridData = new GridData(SWT.BEGINNING, SWT.CENTER, false, false);
myLabel.setLayoutData(gridData);
this.myList_ = new org.eclipse.swt.widgets.List(myComposite, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL);
Point prefSize = this.myList_.computeSize(SWT.DEFAULT, SWT.DEFAULT);
Rectangle reqBounds = this.myList_.computeTrim(0, 0, prefSize.x, this.myList_.getItemHeight() * 10);
this.myList_.setBounds(10, 10, reqBounds.width, reqBounds.height);
gridData = new GridData(SWT.FILL, SWT.BEGINNING, true, false);
this.myList_.setLayoutData(gridData);
this.toolkit_.adapt(this.myList_, true, true);
Thanks in advance,
- Raja.