Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » ExpandBar not expanded properly(When ExpandedBar is expanded, the contect of the ExpandBar is not drawn properly)
ExpandBar not expanded properly [message #538236] Mon, 07 June 2010 01:06 Go to next message
No real name is currently offline No real nameFriend
Messages: 6
Registered: June 2010
Junior Member
I have a rather complex screen:
- top part is an ExpandBar containing a Composite
- a bottom part is a Composite with a table in it

When the top ExpandBar is collapsed and expanded, the content of which is not drawn correctly. But it does redraw properly if I resize the window.

I've tried a lot of ways of calculating the ExpandItem height, layout and pack. Nothing seems to work. Please help. Thanks



package test;

import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ControlAdapter;
import org.eclipse.swt.events.ControlEvent;
import org.eclipse.swt.events.ExpandEvent;
import org.eclipse.swt.events.ExpandListener;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.DateTime;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.ExpandBar;
import org.eclipse.swt.widgets.ExpandItem;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.List;
import org.eclipse.swt.widgets.ScrollBar;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.Text;

public class LogQuery {
	
	private static final int NUM_OF_COLUMNS = 4;
	private Composite parent = null;
	Control newComp = null;
	
	private Table table = null;
	public static final String[] LOG_LEVELS = new String[]{"TRACE", "DEBUG", "INFO", "WARN", "ERROR", "FATAL"};


	public Control createTabFolderPage(Composite tabFolder) {
		parent = tabFolder;	
		
		final Composite composite = new Composite(parent, SWT.NONE);
		composite.setLayout(new GridLayout(1, false));

		GridData gridData = new GridData();
		gridData.horizontalAlignment = GridData.FILL;	
		gridData.grabExcessHorizontalSpace = true;
		final ExpandBar bar = new ExpandBar (composite, SWT.V_SCROLL);
		bar.setLayoutData(gridData);
		
		final Composite page = new Composite(bar, SWT.NONE);
		GridLayout gridLayout = new GridLayout(NUM_OF_COLUMNS, false);
		gridLayout.horizontalSpacing = 20;
		page.setLayout(gridLayout);
		
		Label originLabel = new Label(page, SWT.NONE);
		originLabel.setText("Origin");		
		Text orginText = new Text(page, SWT.NONE);
		gridData = new GridData();
		gridData.horizontalAlignment = GridData.FILL;	
		gridData.grabExcessHorizontalSpace = true;
		gridData.horizontalSpan=2;
		orginText.setLayoutData(gridData);
	
	    Label logLabel = new Label(page, SWT.NONE);
		logLabel.setText("Log Levels");

		Label hostnameLabel = new Label(page, SWT.NONE);
		hostnameLabel.setText("Host Name");
		Text hostText = new Text(page, SWT.NONE);
		gridData = new GridData();
		gridData.horizontalAlignment = GridData.FILL;	
		gridData.grabExcessHorizontalSpace = true;
		gridData.horizontalSpan=2;
		hostText.setLayoutData(gridData);

	    List list = new List(page, SWT.BORDER | SWT.MULTI);	    
	    list.setItems(LOG_LEVELS);
		list.setLayoutData(gridData);
		gridData = new GridData();
		gridData.horizontalAlignment = GridData.FILL;	
		gridData.verticalAlignment = GridData.FILL;	
		gridData.grabExcessHorizontalSpace = true;
		gridData.grabExcessVerticalSpace = true;
		gridData.verticalSpan=4;
		list.setLayoutData(gridData);
		
		Label tagLabel = new Label(page, SWT.NONE);
		tagLabel.setText("Tag");
		Text tagText = new Text(page, SWT.NONE);
		gridData = new GridData();
		gridData.horizontalAlignment = GridData.FILL;	
		gridData.grabExcessHorizontalSpace = true;
		gridData.horizontalSpan=2;
		tagText.setLayoutData(gridData);
		
	
		Label minDateLabel = new Label(page, SWT.NONE);
		minDateLabel.setText("Min Time");
	    DateTime calendar = new DateTime (page, SWT.DATE | SWT.MEDIUM | SWT.BORDER);
	    calendar = new DateTime (page, SWT.TIME  | SWT.MEDIUM | SWT.BORDER);


	    Label maxDateLabel = new Label(page, SWT.NONE);
		maxDateLabel.setText("Max Time");
	    calendar = new DateTime (page, SWT.DATE  | SWT.MEDIUM | SWT.BORDER);
	    calendar = new DateTime (page, SWT.TIME  | SWT.MEDIUM | SWT.BORDER);
	
	
	    Button queryButton = new Button(page, SWT.PUSH);
	    queryButton.setText("Query");
		gridData = new GridData();
		gridData.horizontalAlignment = GridData.FILL;	
		gridData.grabExcessHorizontalSpace = true;
		gridData.horizontalSpan=4;
		queryButton.setLayoutData(gridData);
		
		final ExpandItem item0 = new ExpandItem (bar, SWT.NONE, 0);
		item0.setText("Query parameters");
		item0.setHeight(page.computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
		item0.setControl(page);
		
		item0.setExpanded(true);
		

		bar.addExpandListener(new ExpandListener() {
			
			public void itemExpanded(ExpandEvent e) {
				item0.setText("hostname=Query Parameters");
				System.err.println("Height = " + page.computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
				item0.setHeight(page.computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
				
				Control c = bar;
								
				do {
					if (c instanceof Composite) 
						((Composite)c).layout(true, true);
					
					c = c.getParent();
					
				} while (c != null && c.getParent() != null);
				
				bar.getShell().layout(true, true);
			}
			
			public void itemCollapsed(ExpandEvent e) {
				item0.setText("hostname=xxx");
				System.err.println("page = " + page.computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
				item0.setHeight(item0.getHeaderHeight());
				
				Control c = bar;
								
				do {
					if (c instanceof Composite) 
						((Composite)c).layout(true, true);
					
					c = c.getParent();
					
				} while (c != null && c.getParent() != null);
			}
		});
		
		
		newComp = createTablePage(composite);
		gridData = new GridData();
		gridData.horizontalAlignment = GridData.FILL;	
		gridData.grabExcessHorizontalSpace = true;
		gridData.verticalAlignment = GridData.FILL;	
		gridData.grabExcessVerticalSpace = true;
		newComp.setLayoutData(gridData);

		page.pack();
		composite.pack();
		return composite;
	}

	public Control createTablePage(Composite tabFolder) {
		parent = tabFolder;
		final Composite page = new Composite(parent, SWT.NONE);
		GridLayout gridLayout = new GridLayout(NUM_OF_COLUMNS, false);
		gridLayout.horizontalSpacing = 20;
		page.setLayout(gridLayout);
		

		Combo serviceFilter = new Combo (page, SWT.DROP_DOWN | SWT.READ_ONLY);
		serviceFilter.add("All Services");
		String[] SERVICE_NAMES=new String[]{"Data", "Log", "Config"};
		for (int i=0; i<SERVICE_NAMES.length; i++) {
			serviceFilter.add(SERVICE_NAMES[i]);
		}

		serviceFilter.setText("All Services");


		Combo logLevelFilter = new Combo (page, SWT.DROP_DOWN | SWT.READ_ONLY);
		logLevelFilter.add("All log levels");
		for (int i=0; i<LOG_LEVELS.length; i++) {
			logLevelFilter.add(LOG_LEVELS[i]);			
		}
		logLevelFilter.setText ("All log levels");
		
		Text regExpFilter = new Text(page, SWT.SEARCH | SWT.ICON_SEARCH | SWT.SINGLE);
		
		GridData regexGridData = new GridData();
		regexGridData.horizontalAlignment = GridData.FILL;	
		regexGridData.grabExcessHorizontalSpace = true;

		regExpFilter.setLayoutData(regexGridData);
		
		final Button scroll = new Button(page, SWT.CHECK);
		scroll.setText("Scroll");
		scroll.setSelection(true);
		
		table = new Table (page, SWT.MULTI | SWT.FULL_SELECTION | SWT.V_SCROLL | SWT.BORDER | SWT.VIRTUAL);
		table.setLinesVisible (true);
		table.setHeaderVisible (true);

		TableColumn column = new TableColumn (table, SWT.NONE);
		column.setText ("Timestamp");
		
		column = new TableColumn (table, SWT.NONE);
		column.setText ("Origin");
		
		column = new TableColumn (table, SWT.NONE);
		column.setText ("Host");		
		
		column = new TableColumn (table, SWT.NONE);
		column.setText ("Level");
		
		column = new TableColumn (table, SWT.NONE);
		column.setText ("Message");
		
		column = new TableColumn (table, SWT.NONE);
		column.setText ("Tag");
		
		GridData tableGridData = new GridData();
		tableGridData.horizontalAlignment = GridData.FILL;	
		tableGridData.verticalAlignment = GridData.FILL;	
		tableGridData.grabExcessHorizontalSpace = true;
		tableGridData.grabExcessVerticalSpace = true;
		tableGridData.horizontalSpan = NUM_OF_COLUMNS;

		table.setLayoutData(tableGridData);

		table.setItemCount(100);
		
		setTableSize();		
		page.addControlListener(new ControlAdapter() {
			public void controlResized(ControlEvent e) {
				setTableSize();
			}
		});
		
		
		
		table.pack();
		page.pack();
		
		
		return page;
	}

	public void setTableSize() {
		Rectangle area = table.getParent().getClientArea();
		Point size = table.computeSize(SWT.DEFAULT, SWT.DEFAULT);
		ScrollBar vBar = table.getVerticalBar();
		int width = area.width - table.computeTrim(0,0,0,0).width - vBar.getSize().x;
		if (size.y > area.height + table.getHeaderHeight()) {
			// Subtract the scrollbar width from the total column width
			// if a vertical scrollbar will be required
			Point vBarSize = vBar.getSize();
			width -= vBarSize.x;
		}
		Point oldSize = table.getSize();
		if (oldSize.x > area.width) {
			// table is getting smaller so make the columns 
			// smaller first and then resize the table to
			// match the client area width
			table.getColumn(0).setWidth(200);
			table.getColumn(1).setWidth(150);
			table.getColumn(2).setWidth(50);
			table.getColumn(3).setWidth(50);
			table.getColumn(4).setWidth(width-500);
			table.getColumn(5).setWidth(50);
			table.setSize(area.width, area.height);
		} else {
			// table is getting bigger so make the table 
			// bigger first and then make the columns wider
			// to match the client area width
			table.setSize(area.width, area.height);
			table.getColumn(0).setWidth(200);
			table.getColumn(1).setWidth(150);
			table.getColumn(2).setWidth(50);
			table.getColumn(3).setWidth(50);
			table.getColumn(4).setWidth(width-500);
			table.getColumn(5).setWidth(50);
		}
		table.pack();

	}
	
	public static void main(String[] args) {
		
		try {
			Display display = new Display();
			Shell shell = new Shell(display);
			shell.setSize(800, 500);
			shell.setLayout(new FillLayout());

			(new LogQuery()).createTabFolderPage(shell);
			shell.open();

			while (!display.isDisposed()) {
				if (!display.readAndDispatch())
					display.sleep();
			}
		} catch (Exception e) {
			e.printStackTrace();
		}

	}

}


Re: ExpandBar not expanded properly [message #538246 is a reply to message #538236] Mon, 07 June 2010 05:51 Go to previous messageGo to next message
No real name is currently offline No real nameFriend
Messages: 6
Registered: June 2010
Junior Member
I got the solution. I have to do the layout as another event to be processed after the expanded event:


		bar.addExpandListener(new ExpandListener() {

			public void itemExpanded(ExpandEvent e) {
				Display.getCurrent().asyncExec(new Runnable() {
					public void run() {
						composite.layout();
					}
				});
			}

			public void itemCollapsed(ExpandEvent e) {
				item0.setText("hostname=xxx");
				Display.getCurrent().asyncExec(new Runnable() {
					public void run() {
						composite.layout();
					}
				});
			}
		});		


Re: ExpandBar not expanded properly [message #538911 is a reply to message #538246] Wed, 09 June 2010 04:54 Go to previous messageGo to next message
No real name is currently offline No real nameFriend
Messages: 6
Registered: June 2010
Junior Member
Actually this solution only works on Mac. It does not work on Linux debian5.0.4. And I read on the web that using asyncExec is only a hack. Any ideas?
Re: ExpandBar not expanded properly [message #538928 is a reply to message #538911] Wed, 09 June 2010 06:58 Go to previous messageGo to next message
Vijay RajFriend
Messages: 608
Registered: July 2009
Senior Member
i tryed u r code and the first bug i noticed was u r reusing griddata instance to many times...

ultimatly the final assignment of griddata will apply to all the controls not what u originally intended for a control...

so first cleanup that,after that we can fix the expand problem...


---------------------
why, mr. Anderson, why, why do you persist?
Because I Choose To.
Regards,
Vijay
Re: ExpandBar not expanded properly [message #538932 is a reply to message #538928] Wed, 09 June 2010 07:09 Go to previous messageGo to next message
Vijay RajFriend
Messages: 608
Registered: July 2009
Senior Member
I need help...
Twisted Evil
here is u r solution

package org.eclipse.swt.snippets;

import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ControlAdapter;
import org.eclipse.swt.events.ControlEvent;
import org.eclipse.swt.events.ExpandEvent;
import org.eclipse.swt.events.ExpandListener;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.DateTime;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.ExpandBar;
import org.eclipse.swt.widgets.ExpandItem;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.List;
import org.eclipse.swt.widgets.ScrollBar;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.Text;

public class LogQuery
{

    private static final int NUM_OF_COLUMNS = 4;

    private Composite parent = null;

    Control newComp = null;

    private Table table = null;

    public static final String[] LOG_LEVELS = new String[] { "TRACE", "DEBUG", "INFO", "WARN",
            "ERROR", "FATAL" };

    public Control createTabFolderPage(Composite tabFolder)
    {
        parent = tabFolder;

        final Composite composite = new Composite(parent, SWT.NONE);
        composite.setLayout(new GridLayout(1, false));

        final GridData gridData = new GridData();
        gridData.horizontalAlignment = GridData.FILL;
        gridData.grabExcessHorizontalSpace = true;
        final ExpandBar bar = new ExpandBar(composite, SWT.None);
        bar.setLayoutData(gridData);

        final Composite page = new Composite(bar, SWT.NONE);
        GridLayout gridLayout = new GridLayout(NUM_OF_COLUMNS, false);
        gridLayout.horizontalSpacing = 20;
        page.setLayout(gridLayout);

        Label originLabel = new Label(page, SWT.NONE);
        originLabel.setText("Origin");
        Text orginText = new Text(page, SWT.NONE);
        GridData gridData1 = new GridData();
        gridData1.horizontalAlignment = GridData.FILL;
        gridData1.grabExcessHorizontalSpace = true;
        gridData1.horizontalSpan = 2;
        orginText.setLayoutData(gridData1);

        Label logLabel = new Label(page, SWT.NONE);
        logLabel.setText("Log Levels");

        Label hostnameLabel = new Label(page, SWT.NONE);
        hostnameLabel.setText("Host Name");
        Text hostText = new Text(page, SWT.NONE);
        GridData gridData2 = new GridData();
        gridData2.horizontalAlignment = GridData.FILL;
        gridData2.grabExcessHorizontalSpace = true;
        gridData2.horizontalSpan = 2;
        hostText.setLayoutData(gridData2);

        List list = new List(page, SWT.BORDER | SWT.MULTI);
        list.setItems(LOG_LEVELS);
        GridData gridData3 = new GridData();
        gridData3.horizontalAlignment = GridData.FILL;
        gridData3.grabExcessHorizontalSpace = true;
        gridData3.horizontalSpan = 2;
        list.setLayoutData(gridData3);
        GridData gridData4 = new GridData();
        gridData4.horizontalAlignment = GridData.FILL;
        gridData4.verticalAlignment = GridData.FILL;
        gridData4.grabExcessHorizontalSpace = true;
        gridData4.grabExcessVerticalSpace = true;
        gridData4.verticalSpan = 4;
        list.setLayoutData(gridData4);

        Label tagLabel = new Label(page, SWT.NONE);
        tagLabel.setText("Tag");
        Text tagText = new Text(page, SWT.NONE);
        GridData gridData5 = new GridData();
        gridData5.horizontalAlignment = GridData.FILL;
        gridData5.grabExcessHorizontalSpace = true;
        gridData5.horizontalSpan = 2;
        tagText.setLayoutData(gridData5);

        Label minDateLabel = new Label(page, SWT.NONE);
        minDateLabel.setText("Min Time");
        DateTime calendar = new DateTime(page, SWT.DATE | SWT.MEDIUM | SWT.BORDER);
        calendar = new DateTime(page, SWT.TIME | SWT.MEDIUM | SWT.BORDER);

        Label maxDateLabel = new Label(page, SWT.NONE);
        maxDateLabel.setText("Max Time");
        calendar = new DateTime(page, SWT.DATE | SWT.MEDIUM | SWT.BORDER);
        calendar = new DateTime(page, SWT.TIME | SWT.MEDIUM | SWT.BORDER);

        Button queryButton = new Button(page, SWT.PUSH);
        queryButton.setText("Query");
        GridData gridData6 = new GridData();
        gridData6.horizontalAlignment = GridData.FILL;
        gridData6.grabExcessHorizontalSpace = true;
        gridData6.horizontalSpan = 4;
        queryButton.setLayoutData(gridData6);

        final ExpandItem item0 = new ExpandItem(bar, SWT.NONE, 0);
        item0.setText("Query parameters");
        item0.setHeight(page.computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
        item0.setControl(page);

        item0.setExpanded(true);

        bar.addExpandListener(new ExpandListener()
        {

            public void itemExpanded(ExpandEvent e)
            {
                item0.setText("hostname=Query Parameters");
                System.err.println("Height = " + page.computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
                item0.setHeight(page.computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
                gridData.heightHint = page.computeSize(SWT.DEFAULT, SWT.DEFAULT).y;
                composite.layout(true, true);
            }

            public void itemCollapsed(ExpandEvent e)
            {
                item0.setText("hostname=xxx");
                System.err.println("page = " + page.computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
                item0.setHeight(item0.getHeaderHeight());
                gridData.heightHint = item0.getHeaderHeight();
                composite.layout(true, true);
            }
        });

        newComp = createTablePage(composite);
        GridData gridData7 = new GridData();
        gridData7.horizontalAlignment = GridData.FILL;
        gridData7.grabExcessHorizontalSpace = true;
        gridData7.verticalAlignment = GridData.FILL;
        gridData7.grabExcessVerticalSpace = true;
        newComp.setLayoutData(gridData7);

        page.pack();
        composite.pack();
        return composite;
    }

    public Control createTablePage(Composite tabFolder)
    {
        parent = tabFolder;
        final Composite page = new Composite(parent, SWT.NONE);
        GridLayout gridLayout = new GridLayout(NUM_OF_COLUMNS, false);
        gridLayout.horizontalSpacing = 20;
        page.setLayout(gridLayout);

        Combo serviceFilter = new Combo(page, SWT.DROP_DOWN | SWT.READ_ONLY);
        serviceFilter.add("All Services");
        String[] SERVICE_NAMES = new String[] { "Data", "Log", "Config" };
        for (int i = 0; i < SERVICE_NAMES.length; i++)
        {
            serviceFilter.add(SERVICE_NAMES[i]);
        }

        serviceFilter.setText("All Services");

        Combo logLevelFilter = new Combo(page, SWT.DROP_DOWN | SWT.READ_ONLY);
        logLevelFilter.add("All log levels");
        for (int i = 0; i < LOG_LEVELS.length; i++)
        {
            logLevelFilter.add(LOG_LEVELS[i]);
        }
        logLevelFilter.setText("All log levels");

        Text regExpFilter = new Text(page, SWT.SEARCH | SWT.ICON_SEARCH | SWT.SINGLE);

        GridData regexGridData = new GridData();
        regexGridData.horizontalAlignment = GridData.FILL;
        regexGridData.grabExcessHorizontalSpace = true;

        regExpFilter.setLayoutData(regexGridData);

        final Button scroll = new Button(page, SWT.CHECK);
        scroll.setText("Scroll");
        scroll.setSelection(true);

        table = new Table(page, SWT.MULTI | SWT.FULL_SELECTION | SWT.V_SCROLL | SWT.BORDER
                | SWT.VIRTUAL);
        table.setLinesVisible(true);
        table.setHeaderVisible(true);

        TableColumn column = new TableColumn(table, SWT.NONE);
        column.setText("Timestamp");

        column = new TableColumn(table, SWT.NONE);
        column.setText("Origin");

        column = new TableColumn(table, SWT.NONE);
        column.setText("Host");

        column = new TableColumn(table, SWT.NONE);
        column.setText("Level");

        column = new TableColumn(table, SWT.NONE);
        column.setText("Message");

        column = new TableColumn(table, SWT.NONE);
        column.setText("Tag");

        GridData tableGridData = new GridData();
        tableGridData.horizontalAlignment = GridData.FILL;
        tableGridData.verticalAlignment = GridData.FILL;
        tableGridData.grabExcessHorizontalSpace = true;
        tableGridData.grabExcessVerticalSpace = true;
        tableGridData.horizontalSpan = NUM_OF_COLUMNS;

        table.setLayoutData(tableGridData);

        table.setItemCount(100);

        setTableSize();
        page.addControlListener(new ControlAdapter()
        {
            @Override
            public void controlResized(ControlEvent e)
            {
                setTableSize();
            }
        });

        table.pack();
        page.pack();

        return page;
    }

    public void setTableSize()
    {
        Rectangle area = table.getParent().getClientArea();
        Point size = table.computeSize(SWT.DEFAULT, SWT.DEFAULT);
        ScrollBar vBar = table.getVerticalBar();
        int width = area.width - table.computeTrim(0, 0, 0, 0).width - vBar.getSize().x;
        if (size.y > area.height + table.getHeaderHeight())
        {
            // Subtract the scrollbar width from the total column width
            // if a vertical scrollbar will be required
            Point vBarSize = vBar.getSize();
            width -= vBarSize.x;
        }
        Point oldSize = table.getSize();
        if (oldSize.x > area.width)
        {
            // table is getting smaller so make the columns
            // smaller first and then resize the table to
            // match the client area width
            table.getColumn(0).setWidth(200);
            table.getColumn(1).setWidth(150);
            table.getColumn(2).setWidth(50);
            table.getColumn(3).setWidth(50);
            table.getColumn(4).setWidth(width - 500);
            table.getColumn(5).setWidth(50);
            table.setSize(area.width, area.height);
        }
        else
        {
            // table is getting bigger so make the table
            // bigger first and then make the columns wider
            // to match the client area width
            table.setSize(area.width, area.height);
            table.getColumn(0).setWidth(200);
            table.getColumn(1).setWidth(150);
            table.getColumn(2).setWidth(50);
            table.getColumn(3).setWidth(50);
            table.getColumn(4).setWidth(width - 500);
            table.getColumn(5).setWidth(50);
        }
        table.pack();

    }

    public static void main(String[] args)
    {

        try
        {
            Display display = new Display();
            Shell shell = new Shell(display);
            shell.setSize(800, 500);
            shell.setLayout(new FillLayout());

            (new LogQuery()).createTabFolderPage(shell);
            shell.open();

            while (!display.isDisposed())
            {
                if (!display.readAndDispatch()) display.sleep();
            }
        }
        catch (Exception e)
        {
            e.printStackTrace();
        }

    }

}


---------------------
why, mr. Anderson, why, why do you persist?
Because I Choose To.
Regards,
Vijay

[Updated on: Wed, 09 June 2010 07:10]

Report message to a moderator

Re: ExpandBar not expanded properly [message #539040 is a reply to message #538932] Wed, 09 June 2010 12:17 Go to previous message
No real name is currently offline No real nameFriend
Messages: 6
Registered: June 2010
Junior Member
Ah, my bad. That works. Thank you very much.
Previous Topic:Editable columns of tree viewer
Next Topic:SWT jars with maven
Goto Forum:
  


Current Time: Thu Apr 18 01:58:31 GMT 2024

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

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

Back to the top