SWT + RCP - Tabelle beschränken

mtk-flo

Erfahrenes Mitglied
Hallo,
Ich möchte die Breite und die Höhe einer Tabel angeben. Weiß aber nicht wie, da setSize(int,int) nicht funktioniert.

Wie kann ich meine Tabelle auf Höhe und Breite bechränken?

Folgende Attribute sind wie folgt gesetzt:

this.frage = "Frage";
this.vorschrift = "Vorschrift";
this.antwort = "Die Antwort";

Am Ende sollte es so ungefähr aussehen:

Code:
---------------------------------------------------------------------
|   Tabelle                                                         |
|                                                                   |
|                                                                   |
---------------------------------------------------------------------
|  Frage: Frage                                                     |
|  Vorschrift: Vorschrift                                           |
|  Antwort: Die Antwort                                             |
---------------------------------------------------------------------

Code:
Composite top = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout();
GridLayout layout1 = new GridLayout();
layout.marginHeight = 0;
layout.marginWidth = 0;
top.setLayout(layout);
// top banner
Composite head = new Composite(top, SWT.NONE);
head.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END, GridData.VERTICAL_ALIGN_BEGINNING, false, false));
layout1 = new GridLayout();
layout1.marginHeight = 5;
layout1.marginWidth = 10;
layout1.numColumns = 1;
head.setLayout(layout);
 
// top banner
Composite banner = new Composite(top, SWT.NONE);
banner.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL, GridData.VERTICAL_ALIGN_BEGINNING, true, false));
layout = new GridLayout();
layout.marginHeight = 5;
layout.marginWidth = 10;
layout.numColumns = 2;
banner.setLayout(layout);
 
// setup bold font
Font boldFont = JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT); 
 
Table table = new Table(head, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION);
GridData tableData = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 2);
table.setLayoutData(tableData);
table.getHorizontalBar();
table.getVerticalBar();
 
for (int i=0; i<120; i++) {
TableItem item = new TableItem (table, 0);
item.setText ("Item (also die Frage des Themenbereiches) #" + i);
}
 
 
 
 
 
Label l = new Label(banner, SWT.WRAP);
l.setText("Frage:");
l.setFont(boldFont);
l = new Label(banner, SWT.WRAP);
l.setText(this.frage);
 
l = new Label(banner, SWT.WRAP);
l.setText("Vorschrift:");
l.setFont(boldFont);
l = new Label(banner, SWT.WRAP);
l.setText(this.vorschrift);
 
l = new Label(banner, SWT.WRAP);
l.setText("Antwort:");
l.setFont(boldFont);
l = new Label(banner, SWT.WRAP);
l.setText(this.antwort);
 
Zurück