How can I set RenderingHints globally?

旧巷老猫 提交于 2019-12-21 13:09:42

问题


For a Java application, can I set the RenderingHints on a global basis? Currently, I've defined these in the paintComponent method as shown below. I would prefer, however, to set them once when the application starts and have them persist throughout the session.

@Override
protected void paintComponent(Graphics g)
{
super.paintComponent(g);

Graphics2D g2d = (Graphics2D) g;
    g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
}

Thanks.


回答1:


There's a system property for that.



来源:https://stackoverflow.com/questions/779198/how-can-i-set-renderinghints-globally

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