简体   繁体   中英

Swing repainting

I'm having an animation on a JComponent. The animation is simply a BufferedImage on which ç draw something that is moving. To make BufferedImage appear/disappear progressively, i'm calling repaint with a clip area that is smaller than the width of my JComponent. The problem i've got, is that when swing has to repaint the component it draws the BufferedImage outside of my clipping area bounds. How can i improve this? Thanks for help.

If you want the image to appear and disappear, I would simply not paint it on cycles where you don't want it to display, rather than messing with the clip region for that purpose. This would be more efficient too, since otherwise, the JVM has to calculate what part of the image is in view.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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