JLabel - is it possible to set RenderingHints.VALUE_TEXT_ANTIALIAS_OFF?

谁都会走 提交于 2021-01-28 05:16:17

问题


Is it possible to turn off ANTIALIAS in JLabel? Something like this (but it is not working..):

@Override
    public void paintComponent(Graphics g) {

        Graphics2D graphics2d = (Graphics2D) g;
        graphics2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_OFF);
        super.paintComponent(g);
    }
}

Or should I create custom Label where I can easily set this ANTIALIAS value? The goal is to make the text not fuzzy.


回答1:


Found the solution (first lines when application starts):

System.setProperty("awt.useSystemAAFontSettings", "off");
System.setProperty("swing.aatext", "false");

Now everything is OK, I can see nice fonts on my Eizo ColorEdge display. My question - why the hell Windows OS uses all that blurred/fuzzy settings also... And almost impossible to switch off antialiasing.. Try to do that in Windows10 taskbar at the Desktop bottom.... Nightmare. It is hard to believe that someone could use it and say "it's OK" :) I believe the rivals are coming :)



来源:https://stackoverflow.com/questions/29016071/jlabel-is-it-possible-to-set-renderinghints-value-text-antialias-off

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!