How to set vertical alignment in jface tableviewer?
I created a jface CheckboxTableviewer and set its row height to 40px.
But in windows xp, the checkbox is not aligning to the middle.
How can I change the alignment?
public class TableTest extends Dialog {
public TableTest(Shell parent) {
super(parent);
}
@Override
protected void configureShell(Shell newShell) {
super.configureShell(newShell);
newShell.setText("CheckboxTableViewer");
newShell.setSize(500,300);
}
@Override
protected Control createDialogArea(Composite parent) {
Composite container = (Composite) super.createDialogArea(parent);
container.setLayout(new FillLayout());
CheckboxTableViewer tbv = CheckboxTableViewer.newCheckList(container, SWT.BORDER|SWT.FULL_SELECTION);
Table table = tbv.getTable();
table.setLinesVisible(true);
table.addListener(SWT.MeasureItem, new Listener() {
@Override
public void handleEvent(Event e) {
e.height = 40;
}
});
tbv.setContentProvider(new ArrayContentProvider());
List<String> inputs = new ArrayList<String>();
inputs.add("One开发者_如何转开发");
inputs.add("Two");
inputs.add("Three");
tbv.setInput(inputs);
return container;
}
public static void main(String[] args) {
TableTest t = new TableTest(new Shell());
t.open();
}
}
精彩评论