|High contrast mode setting for textbox in a jface dialog [message #673420]
||Mon, 23 May 2011 15:19
Registered: May 2011
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() )
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,
Powered by FUDForum
. Page generated in 0.01784 seconds