本文介绍了我如何设置全局RenderingHints?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
对于Java应用程序,我可以在全局基础上设置RenderingHints吗?目前,我已经在paintComponent方法中定义了这些方法,如下所示。然而,我希望在应用程序启动时将它们设置为一次,并在整个会话期间保留它们。
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);
}
谢谢。 b $ b
Thanks.
推荐答案
有一个为此。
这篇关于我如何设置全局RenderingHints?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!