问题
I have NatTable with column and row headers, and use CornerLayer for it. How to make row and column headers resizable like any other column or row?
回答1:
You need to register the necessary bindings to the header regions
gridLayer.addConfiguration(new AbstractUiBindingConfiguration() {
@Override
public void configureUiBindings(UiBindingRegistry uiBindingRegistry) {
uiBindingRegistry.registerFirstMouseMoveBinding(
new ColumnResizeEventMatcher(SWT.NONE, GridRegion.ROW_HEADER, 0),
new ColumnResizeCursorAction());
uiBindingRegistry.registerFirstMouseDragMode(
new ColumnResizeEventMatcher(SWT.NONE, GridRegion.ROW_HEADER, 1),
new ColumnResizeDragMode());
uiBindingRegistry.registerFirstMouseMoveBinding(
new RowResizeEventMatcher(SWT.NONE, GridRegion.COLUMN_HEADER, 0),
new RowResizeCursorAction());
uiBindingRegistry.registerFirstMouseDragMode(
new RowResizeEventMatcher(SWT.NONE, GridRegion.COLUMN_HEADER, 1),
new RowResizeDragMode());
}
});
来源:https://stackoverflow.com/questions/38637088/resizable-row-column-headers-in-nattable