开发者

Is it possible to move an Icon?

In Java, is it p开发者_C百科ossible to use paintIcon to put an icon into a canvas, and then move that icon around using keyboard events like you would a game character?


Once you paint something on the canvas, it stays there, and what was there beneath that location is lost. To "move" the icon, you need to repaint the canvas (or at least what was originally at the location of the icon) and draw the icon at its new position.


This would work better with an applet by registering keylisteners. and overridding the paint method

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜