Frage

I am learning to work with SWT. I added two Tables to one Composite using:

    TabFolder tabFolder = new TabFolder(shell, SWT.NONE);
    tabFolder.setLayoutData(BorderLayout.CENTER);

    TabItem tbtmData = new TabItem(tabFolder, SWT.NONE);
    tbtmData.setText("data");

    scrolledComposite = new ScrolledComposite(tabFolder, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
    tbtmData.setControl(scrolledComposite);
    scrolledComposite.setExpandHorizontal(true);
    scrolledComposite.setExpandVertical(true);

    tableComposite = new Composite(scrolledComposite, SWT.NONE);
    RowLayout rl_tableComposite = new RowLayout(SWT.HORIZONTAL);
    tableComposite.setLayout(rl_tableComposite);

    table_2 = new Table(tableComposite, SWT.BORDER | SWT.FULL_SELECTION);
    table_2.setHeaderVisible(true);
    table_2.setLinesVisible(true);

    table_3 = new Table(tableComposite, SWT.BORDER | SWT.FULL_SELECTION);
    table_3.setLayoutData(new RowData(261, 45));
    table_3.setTopIndex(1);
    table_3.setHeaderVisible(true);
    table_3.setLinesVisible(true);



    scrolledComposite.setContent(tableComposite);
    scrolledComposite.setMinSize(tableComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT));

    TabItem tbtmGraph = new TabItem(tabFolder, SWT.NONE);
    tbtmGraph.setText("graph");

    Canvas canvas = new Canvas(tabFolder, SWT.NONE);
    tbtmGraph.setControl(canvas);

Now, in the window I see table_2 in the left and table_3 in the right. How to change the order in a runtime? Adding table_3 first is not an option in my case.

One more question. if i call table.setSize(0, 0); I don't see any changes in table appearance. I tried to call table.redraw() after that, but still, size of the table is not changing. where is my mistake?

War es hilfreich?

Lösung

You can call:

tableThree.moveAbove(tableTwo);

See the javadoc for more detail.

As for your second question:

Why do you want to set the size to 0? Doesn't Control#setVisible(false) do the trick?

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top