Graphics2D.drawLine() wrongly draws the first (or the last) point

Hi

I draw a diagonal cross in the right side of each tab in a JTabbedPane and as you can see, there is something wrong:

https://bugzilla.redhat.com/attachment.cgi?id=922112

It seems to be reproducible only on a very few GNU Linux distros with OpenJDK. Please can anybody run some of the test cases we posted in the bug report below?
https://bugzilla.redhat.com/show_bug.cgi?id=1124374

It’s not reproducible with Oracle Java. I reproduce this bug under Mageia Linux 4 with OpenJDK 1.7 update 65 but someone else doesn’t reproduce this bug with the same version of OpenJDK under Fedora Linux 20 and 21.

Best regards.

Interesting bug. It’s probably not worth waiting for the fix. Such bugs are solved at glacial speeds.

Obvious workaround: use icons, in this specific case.

I hope I won’t have to fix it by myself. Nobody answered me on the OpenJDK Java2D mailing list :frowning:

Yes I can use an ImageIcon or draw in a BufferedImage and draw this BufferedImage in the right side of the tab.

I don’t want to stop using Swing, I don’t want to spend several months in porting JFPSM to another API :frowning: (even though LibGDX Scene2D seems to be really cool).

This bug only concerns Mageia Linux, it’s not very important. It shouldn’t be very hard to fix as it works under Fedora and SUSE.

Hi

Actually, this bug comes from the old X11 renderer which isn’t used by default in OpenJDK 1.8 which uses the XRender pipeline. Riven is right, it will never be fixed but the XRender pipeline doesn’t have it.

If you’re forced to use Java 1.7, enable the OpenGL pipeline by using -Dsun.java2d.opengl=True (but it might expose you to some other bugs). Otherwise, switch to OpenJDK 8.

Hi

Actually, as the XRender pipeline is available in OpenJDK 1.7 but only enabled by default in OpenJDK 1.8, enabling it seems less dangerous than enabling the build-in OpenGL pipeline:
-Dsun.java2d.xrender=True

I’ll test this pipeline with OpenJDK 1.7 during some days to see whether it is viable as I don’t want to switch to OpenJDK 1.8 now.

Edit.: It seems to work:
INFO: The version of libXrender.so is detected as 0.98
XRender pipeline enabled
Xrender: INFO: Jules library not installed.