views:

22

answers:

1

When i assign text to my Labels, they wrap around it very tightly, sometimes cutting the lower edges off 'p', 'y' and alike. I would like to have some padding between text and border. I am using a TableWrapLayout for the parent Composite and TableWrapData for the Labels

    TableWrapLayout layout = new TableWrapLayout();
    layout.numColumns = 2;
    layout.bottomMargin = 10;
    layout.topMargin = 10;
    client.setLayout(layout);

    Label label= toolkit.createLabel(client, "", SWT.NONE);

We are using the FormToolkit for consistent design, IMHO this has no influence on border painting

A: 

Layout (such as GridLayout) and LayoutData (e.g. GridData) objects in SWT can only control spacing outside a control (so they may only set margins, not padding). In order to change control side itself you can only use setSize() and setBound().

Mohsen
so it means sth like 'Point p = label.getSize(); p.x +=4; p.y += 4; label.setSize(p);' Seems kludgy but actually works, as a good kludge should :)
kostja
Yes, something like what you write.
Mohsen