[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform.swt] Re: Missing labels

Tom Schindl schrieb:
Richard Cheney schrieb:
I've written the following piece of code to demonstrate a problem we've been having:

import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;

public class TestComp extends Composite {

    private Label labelTitle = null;
    private Label label = null;

    public TestComp(Composite parent, int style) {
        super(parent, style);
        initialize();
    }

private void initialize() {
GridData gridData = new GridData();
gridData.horizontalSpan = 11;
gridData.grabExcessHorizontalSpace = true;
gridData.horizontalAlignment = org.eclipse.swt.layout.GridData.CENTER;
labelTitle = new Label(this, SWT.NONE);
labelTitle.setText("Title Area");
labelTitle.setLayoutData(gridData);
GridData gridData2 = new GridData();
gridData2.horizontalSpan = 1;
gridData2.grabExcessHorizontalSpace = true;
gridData2.horizontalAlignment = org.eclipse.swt.layout.GridData.CENTER;
for(int i = 0; i < 22; i++) {
Label label = new Label(this, SWT.NONE);
label.setText("CELL");
label.setLayoutData(gridData2);
}

You can reuse a GridData-Instance for mulitple elements. Move the
^^^^^^^^^can't

Tom

--
B e s t S o l u t i o n . at
--------------------------------------------------------------------
Tom Schindl                                          JFace-Committer
--------------------------------------------------------------------