ScrolledComposite is not displaying scroll bars [message #902272] |
Thu, 16 August 2012 17:28 |
San Kallada Messages: 3 Registered: August 2012 |
Junior Member |
|
|
Hi All,
I'm trying to create an UI for my eclipse plugin with SWT (using Eclipse Juno and Window Builder). I have table component which is added to a ScrolledComposite. This table is supposed to show about 100 rows od data. But with the code below, the ScrolledComposite is not showing up the desired scroll bars, rather the windo grows vertically.
I'm looking forward for some pointers to solve the issue( I'm very new to plug-in development).
Thanks in advance
protected Control createDialogArea(Composite parent) {
Display display = Display.getDefault();
Color yellow = display.getSystemColor(SWT.COLOR_YELLOW);
Color red = display.getSystemColor(SWT.COLOR_RED);
Color black = display.getSystemColor(SWT.COLOR_BLACK);
Color white = display.getSystemColor(SWT.COLOR_WHITE);
Color green = display.getSystemColor(SWT.COLOR_GREEN);
/* Shell*/
//Shell shell = new Shell(display);
//shell.setSize(652, 628);
//shell.setLayout(new GridLayout());
/* Error Panel*/
Composite errorPanel = new Composite(parent, SWT.NONE);
errorPanel.setBackground(red);
/* Base Panel*/
Composite basePanel = new Composite(parent, SWT.NONE);
//basePanel.
//basePanel.
basePanel.setLayout(new GridLayout(2, false));
basePanel.setBackground(yellow);
/*Table Panel*/
ScrolledComposite tablePanel = new ScrolledComposite(basePanel, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
tablePanel.setBackground(green);
tablePanel.setExpandHorizontal(true);
tablePanel.setExpandVertical(true);
table = new Table(tablePanel, SWT.BORDER | SWT.FULL_SELECTION);
table.setHeaderVisible(true);
table.setLinesVisible(true);
// table.setSize(100, 150);
tablePanel.setContent(table);
// tablePanel.setSize(100, 100);
tablePanel.setMinSize(table.computeSize(SWT.DEFAULT, SWT.DEFAULT));
/* Create table columns*/
TableColumn columnSelect = new TableColumn(table, SWT.NONE);
columnSelect.setWidth(100);
columnSelect.setText("Select");
TableColumn columnField = new TableColumn(table, SWT.NONE);
columnField.setWidth(100);
columnField.setText("Field");
TableColumn columnHTMLtype = new TableColumn(table, SWT.NONE);
columnHTMLtype.setWidth(100);
columnHTMLtype.setText("Type");
/* Generate table content*/
for (int i = 0; i < 100; i++) {
new TableItem(table, SWT.NONE);
}
TableItem[] items = table.getItems();/**/
/*
* Right button panel
*/
Composite shortCutPanel = new Composite(basePanel, SWT.NONE);
shortCutPanel.setBackground(black);
for (int i = 0; i < items.length; i++) {
TableEditor editor = new TableEditor(table);
CCombo combo = new CCombo(table, SWT.NONE);
addComboContent(combo);
editor.grabHorizontal = true;
editor.setEditor(combo, items[i], 2);
editor = new TableEditor(table);
Label lblTest = new Label(table, SWT.NONE);
lblTest.setBackground(white);
lblTest.setText("foo"+i);
editor.grabHorizontal = true;
editor.setEditor(lblTest, items[i], 1);
editor = new TableEditor(table);
Button button = new Button(table, SWT.CHECK);
button.pack();
editor.minimumWidth = button.getSize().x;
editor.horizontalAlignment = SWT.CENTER;
editor.setEditor(button, items[i], 0);
}/**/
Dialog.applyDialogFont(basePanel);
return basePanel;
}
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.01880 seconds