Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set SWT label padding?

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

like image 922
kostja Avatar asked Feb 26 '23 08:02

kostja


1 Answers

(Answer many years later, but still an answer...)

CLabel cl = new CLabel(shell, SWT.CENTER);
int padding = 5;
cl.setMargins(padding, padding, padding, padding);
like image 147
DavidL Avatar answered Mar 07 '23 02:03

DavidL