开发者

How to do Font Smoothing for AWT/Swing Application?

I need to do font smoothing for a AWT application on Windows System. On doing googling I came to know that I can set following VM argument in Eclipse.

-Dawt.useSystemAAFontSettings=gasp

But this is not yielding any positive results. If anyone is having a better idea on how to achieve Font Smoothing, then kindly let me know.

EDIT After Answer By Andrew

I added the following snippet of code in paint method

public class BottomSubmitButtons extends Canvas {

@Override
public void paint(Graphics g) {

    Graphics2D g2 = (Graphics2D)g;
    RenderingHints rh = new RenderingHints(
            RenderingHints.KEY_TEXT_ANTIALIASING,
            RenderingHints.VALUE_TEXT_ANTIALIAS_GASP);
    g2.setRenderingHints(rh);
}
}

This seems to have improved the smoothing in one of the sub panel. But doing the same in other panel is not yielding any smoothing. Also the TextField boxes are going invisible by default, though they becomes visible once I开发者_运维知识库 click in that area


Play with the values for RenderingHints.KEY_TEXT_LCD_CONTRAST. When you find something that works, use that as the command line value.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜