Get rid of flicker in SWT

We use the following class to show a progress bar in our Java application: TextProgressBar

Unfortunately, we have some flickering problems when using this (Win 7, Java 7). Do you have any tips on how we can avoid this? Can we somehow redraw it less often, use double buffering, or something else? Any advice is appreciated!

+6
source share
4 answers

First try passing SWT.DOUBLE_BUFFERED in for the style parameter when building. If this does not improve the situation, move the parent chain and add SWT.DOUBLE_BUFFERED to their constructor call.

If you have no control over the parent, you will most likely need to wrap your control in another Composite that has this flag.

+4
source

try SWT.NO_BACKGROUND firstly and if not use SWT.DOUBLE_BUFFERED . Do not use both at the same time because there is no point. See discussion

+1
source

Disclaimer: I know that the question asks a question about the TextProgressBar . However, I believe that many views on this issue are not limited to these widgets.

I had a problem with the flickering of the Text widget, which I could not solve with the SWT.DOUBLE_BUFFERED style, either by wrapping it with Composite , or by applying any combination of them.

Finally, I was able to solve this problem by simply changing the type of widgets from Text to StyledText . No flicker even without the SWT.DOUBLE_BUFFERED style and without the Composite shell.

Hope this helps someone who was attracted by the broad title of this question.

+1
source

you can try to delay time with thread.sleep () . This worked for me when I had the same issue when working with jTables

-3
source

Source: https://habr.com/ru/post/945757/


All Articles