Micha Wiedenmann
Micha Wiedenmann

Reputation: 20823

How can I set the margin/padding of the text displayed on an SWT Button?

How can I set the margin/padding of the text displayed on an SWT Button?

Button b = new Button(parent, SWT.LEFT);
b.setText("Click me");

I got:

+-----------------+
|Click me         |
+-----------------+

I want (notice the space to the left):

+-----------------+
| Click me        |
+-----------------+

Upvotes: 4

Views: 1934

Answers (1)

Tonny Madsen
Tonny Madsen

Reputation: 12718

Padding is not supported for Button. The standard solutions are to either use SWT.CENTER or alternatively add a space to the start of the label...

Upvotes: 2

Related Questions