Resizable row/column headers in NatTable

我只是一个虾纸丫 提交于 2019-12-12 02:35:15

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!