0

I would like to know if it is possible to change the color of hint text of a Text widget in SWT. I tried by setting the foreground color using setForeground() but hint text color remained same. Is there any workaround possible?

Baz
  • 36,440
  • 11
  • 68
  • 94
Jayakrishnan Salim
  • 977
  • 1
  • 10
  • 24
  • What is hint text?You can share screen-shot here http://imgur.com/ – Chandrayya G K May 21 '14 at 05:15
  • Hint text is something which gives a message to the user on what the field is for. This is set using setMessage() method of Text widget. – Jayakrishnan Salim May 21 '14 at 05:27
  • 1
    possible duplicate of [Selected color of prompt/message in empty text box](http://stackoverflow.com/questions/13586772/selected-color-of-prompt-message-in-empty-text-box) – Baz May 21 '14 at 06:32

1 Answers1

1

Check the setMessage() method source code of Text widget. It uses the the foreground colour of the place holder text in the underlying OS. I don't know how to tweak it.

But you can:

Add focus listeners to Text Widget and use setText() and setForeground() methods to show or hide the message.

Refer Selected color of prompt/message in empty text box and Python Gtk.Entry placeholder text.

Community
  • 1
  • 1
Chandrayya G K
  • 8,719
  • 5
  • 40
  • 68