Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Plugin Development Environment (PDE) » ScrolledComposite is not displaying scroll bars(While trying to create an UI for my eclipse plugin, ScrolledComposite is not showing the desired scroll bars. )
ScrolledComposite is not displaying scroll bars [message #902272] Thu, 16 August 2012 17:28 Go to next message
San Kallada is currently offline San KalladaFriend
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);

/* Base Panel*/
Composite basePanel = new Composite(parent, SWT.NONE);
basePanel.setLayout(new GridLayout(2, false));

/*Table Panel*/
ScrolledComposite tablePanel = new ScrolledComposite(basePanel, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);

table = new Table(tablePanel, SWT.BORDER | SWT.FULL_SELECTION);
// table.setSize(100, 150);
// tablePanel.setSize(100, 100);

tablePanel.setMinSize(table.computeSize(SWT.DEFAULT, SWT.DEFAULT));

/* Create table columns*/

TableColumn columnSelect = new TableColumn(table, SWT.NONE);
TableColumn columnField = new TableColumn(table, SWT.NONE);
TableColumn columnHTMLtype = new TableColumn(table, SWT.NONE);

/* 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);

for (int i = 0; i < items.length; i++) {
TableEditor editor = new TableEditor(table);
CCombo combo = new CCombo(table, SWT.NONE);
editor.grabHorizontal = true;
editor.setEditor(combo, items[i], 2);
editor = new TableEditor(table);
Label lblTest = new Label(table, SWT.NONE);
editor.grabHorizontal = true;
editor.setEditor(lblTest, items[i], 1);
editor = new TableEditor(table);
Button button = new Button(table, SWT.CHECK);
editor.minimumWidth = button.getSize().x;
editor.horizontalAlignment = SWT.CENTER;
editor.setEditor(button, items[i], 0);


return basePanel;
Re: ScrolledComposite is not displaying scroll bars [message #911860 is a reply to message #902272] Wed, 12 September 2012 13:14 Go to previous messageGo to next message
Sharon Snyder is currently offline Sharon SnyderFriend
Messages: 56
Registered: September 2010

If memory serves, you have to set the content before your calls setExpandHorizontal or setExpandVertical.

I usually put these 3 together after the content has been created.

Hope this helps and isn't too late to be useful.

Re: ScrolledComposite is not displaying scroll bars [message #922943 is a reply to message #911860] Tue, 25 September 2012 13:27 Go to previous message
San Kallada is currently offline San KalladaFriend
Messages: 3
Registered: August 2012
Junior Member
thanks Sharon
Previous Topic:NotHandledException with dynamic menu in Juno
Next Topic:How to get tests visible to the launcher?
Goto Forum:

Current Time: Sat Dec 16 15:09:09 GMT 2017

Powered by FUDForum. Page generated in 0.02126 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software