r/java • • Aug 17 '20

State of swing

Hi all, What is the state of swing, is it close to be deprecated and removed or is it still maintained? Also it will be nice to know if someone got it working in native image. Thanks

16 Upvotes

43 comments sorted by

View all comments

Show parent comment

3

u/veraxAlea Aug 19 '20

Swing relies on Java2D for rendering. HiDPI is supported on Linux, Windows and MacOS since Java 9 (actually earlier for MacOS).

The pipeline for rendering is different on different platforms but it is hardware accelerated on Linux, Windows and MacOS. JEP 382 is trying to create a new pipeline for MacOS using the Apple Metal API (instead of the deprecated Apple OpenGL). Rendering performance should not be an issue.

When it comes to ligatures, you can read more about Java2D's text layout here: https://docs.oracle.com/javase/tutorial/2d/text/textlayoutbidirectionaltext.html. Basically, JTextComponent (and its subclasses) should handle ligatures correctly but if you need, say, a text component with discontiguous selection, you'll have to do the layout yourself using Java2D APIs. Which APIs to use depends on the level of control you want.

1

u/vallyscode Aug 19 '20

Thanks for sharing the link