I know how to change size, style but how can I set colour of text in Label control? Here is my code so far:
Label myLabel = new Label(shell, SWT.NONE);
myLabel.setText("some text that needs to be for example green");
FontData[] fD = myLabel.getFont().getFontData();
fD[0].setHeight(16);
fD[0].setStyle(SWT.BOLD);
myLabel.setFont( new Font(display,fD[0]));
I see there is no colour property in FontData class.
Make sure you don’t mix SWT and AWT colors, and if you build a
Colorobject, make sure you dispose it. You want something like:Or you can just use the built-in system colors:
(Do not dispose the system colors.)