NatTable 中可调整大小 row/column headers

Resizable row/column headers in NatTable

我有带列和行的 NatTable headers,并为其使用 CornerLayer。如何使行和列 headers 像任何其他列或行一样可调整大小?

您需要将必要的绑定注册到 header 区域

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());
    }
});