简体   繁体   English

Java Graphics2D drawRect 抛出“sg2d.loops”是 null

[英]Java Graphics2D drawRect throw "sg2d.loops" is null

java.lang.NullPointerException: Cannot read field "fillParallelogramLoop" because "sg2d.loops" is null
        at java.desktop/sun.java2d.pipe.LoopPipe.fillParallelogram(LoopPipe.java:355)
        at java.desktop/sun.java2d.pipe.PixelToParallelogramConverter.drawGeneralLine(PixelToParallelogramConverter.java:287)
        at java.desktop/sun.java2d.pipe.PixelToParallelogramConverter.drawLine(PixelToParallelogramConverter.java:80)
        at java.desktop/sun.java2d.pipe.PixelToParallelogramConverter.drawRect(PixelToParallelogramConverter.java:103)
        at java.desktop/sun.java2d.SunGraphics2D.drawRect(SunGraphics2D.java:2410)

I just used Graphics2D to draw something on the BufferedImage.我刚刚使用 Graphics2D 在 BufferedImage 上绘制了一些东西。

I solved this problem through the synchronous lock.我通过同步锁解决了这个问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM