Make JFace TableViewer resize with its surrounding composite?

Using WindowBuilder for Eclipse, I created TableViewerwhich I placed inside the composite. ( TableViewercreates the SWT Tableinto which it is inserted TableViewer).

I tried to make the composite resizable by setting grabExcessHorizontalSpaceit grabVerticalSpaceto true, but how do I make the table as well and TableViewerpopulate the composite?

+3
source share
2 answers

It's hard to say without code, but from your description you are not setting the layout to your own Composite. Try adding composite.setLayout(new FillLayout());if your composite contains only TableViewer.

, , GridLayout MigLayout. layoutData .

, , GridLayout. MigLayout, , . .

+3

( rcjsuen #eclipse irc.freenode.net).

, , :       Composite comp = Composite (, SWT.NONE);       comp.setLayoutData( GridData (SWT.LEFT, SWT.TOP, true, true, 1, 1));

, grabExcessiveHorizontalSpace grabExcessiveVerticalSpace true ( 3 4 setLayoutData()), 1 2 SWT.FILL, FillLayout setLayout(), :

    Composite comp = new Composite(container, SWT.NONE);
    comp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
    comp.setLayout(new FillLayout());
+4

Source: https://habr.com/ru/post/1781639/


All Articles