High contrast mode setting for textbox in a jface dialog [message #673420] |
Mon, 23 May 2011 15:19 |
Ravi Messages: 4 Registered: May 2011 |
Junior Member |
|
|
Hello,
I have SWT Text box in a JFace Dialog along with other controls like buttons and tableviewer. In normal mode, if I don't set the background, the text box defaults to gray looking as if it is a read-only field. I changed it to white. But, in a high contrast mode, both the text and background become white making the text non-readable (unless highlighted).
I tried 2 things that worked:
1) if ( !parent.getDisplay().getHighContrast() )
text.setbackground(white);
2) text.setbackground( parent.getDisplay().getSystemColor( SWT.COLOR_LIST_BACKGROUND ));
text.setForeground( parent.getDisplay().getSystemColor( SWT.COLOR_LIST_FOREGROUND ));
What are the COLOR_LIST_XXX constants meant for?
I want to know what is the coding practice to create such UI that works in both normal and high contrast mode. There isn't much text available around.
Thanks in advance,
Ravi
|
|
|
Powered by
FUDForum. Page generated in 0.01585 seconds