1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
public void addSpinner(int value, ModifyListener modify) {
if (NCurCol == 0)
NCurItem = new TableItem(table, SWT.RIGHT);
TableEditor editor = new TableEditor(table);
Spinner spinner = new Spinner(table, modify == null ? SWT.DROP_DOWN
| SWT.READ_ONLY | SWT.CENTER : SWT.DROP_DOWN | SWT.CENTER);
spinner.setVisible(true);
spinner.setSelection(value);
spinner.setMinimum(Integer.MIN_VALUE);
spinner.setMaximum(Integer.MAX_VALUE);
spinner.pack();
if (modify != null)
spinner.addModifyListener(modify);
else
spinner.setEnabled(false);
editor.minimumWidth = spinner.getSize().x;
editor.horizontalAlignment = SWT.LEFT;
editor.setEditor(spinner, NCurItem, NCurCol);
NCurItem.setData(Integer.toString(NCurCol), editor);
NCurCol = (NCurCol + 1) % table.getColumnCount();
} |
Partager