views:

421

answers:

3

I've called gc.setAntialias(SWT.ON); and it does nothing. According to that method, it should work.

The Javadoc states:

Sets the receiver's anti-aliasing value to the parameter, which must be one of SWT.DEFAULT, SWT.OFF or SWT.ON.

It's not working for me, and I'm painting on a simple Canvas.

+1  A: 

The following worked for me in an app I built and my guesses at when/how you have to do this.

So I created a new GC, set the Antialias as you did and then drew what I needed to with that gc object. The key is attaching it to the shell you will draw in.

GC gc = new GC(shell);
gc.setAntialias(SWT.ON); 
//then I attach to LightweightSystem for testing.
LightweightSystem lws = new LightweightSystem(shell);

Other than that make sure you do this before you draw anything. If you have to call it afterwards maybe try calling a repaint or redraw of the entire space.

Sorry without more information I am not sure exactly what is wrong.

Ted Johnson
A: 

Also, if you're drawing labels, make sure you use gc.setTextAntialias( SWT.ON );

You can also check if gc.getAdvanced() returns true, it should after setAntialias() or setTextAntialias was set.

Besides from that it's pretty straight forward.

derBiggi
A: 

Following derBiggi's answer, you ca also force the advanced option to true.

gc.setAdvanced(true)
nanda