How can I turn off anti-aliasing for one specific JLabel?
-
11-07-2019 - |
Question
How can I turn off anti-aliasing for one specific JLabel? It uses a very small font which might look better without anti-aliasing.
If important, I'm using Java 1.5 on Mac OS X.
Solution
I think you'll have to override the paint(Graphics g) method and draw the text yourself.
OTHER TIPS
Have you tried overriding paint(Graphics g) or paintComponent(Graphics g), setting rendering hints for text AA on the graphics object and calling the super method?
see RenderingHints: https://docs.oracle.com/javase/7/docs/api/java/awt/RenderingHints.html#VALUE_TEXT_ANTIALIAS_OFF
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow