SunGraphics2D.java 文件源码

java
阅读 27 收藏 0 点赞 0 评论 0

项目:jdk8u-jdk 作者:
public void drawString(String str, int x, int y) {
    if (str == null) {
        throw new NullPointerException("String is null");
    }

    if (font.hasLayoutAttributes()) {
        if (str.length() == 0) {
            return;
        }
        new TextLayout(str, font, getFontRenderContext()).draw(this, x, y);
        return;
    }

    try {
        textpipe.drawString(this, str, x, y);
    } catch (InvalidPipeException e) {
        try {
            revalidateAll();
            textpipe.drawString(this, str, x, y);
        } catch (InvalidPipeException e2) {
            // Still catching the exception; we are not yet ready to
            // validate the surfaceData correctly.  Fail for now and
            // try again next time around.
        }
    } finally {
        surfaceData.markDirty();
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号