Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
摇摆是否允许转换
paint (Graphics g) { Graphics2D g2d = (Graphics2D) g; ...... }
会一直工作吗?或者可能有不同的图形实现,不仅是 Graphics2D?
简短的回答是,是的,它应该可以工作,除非您使用其他一些 JVM。我不记得具体是从什么时候开始的,但是 Swings 绘制引擎将始终使用 Graphics2D 实例来执行其组件绘制