0

I have Label in SWT The text is

     "Doctor\ntest\ttest2"

I want to change it to

       "Doctor
       test     test2"

menaing to change the \n to new line and \t to tab. Can I do it in Label in SWT? Do I need to change the control ?

user1365697
  • 5,819
  • 15
  • 60
  • 96

1 Answers1

2

You can do this in the label control.

final Label label = new Label(composite, SWT.NULL );
label.setText( "Line one \n line two  abc \t tabbed" );
label.pack();

Results in: enter image description here

You can also do this by using a Text-Control and set it disabled.

Mirco
  • 2,940
  • 5
  • 34
  • 57