0

I was wondering how you can switch the picture being loaded into a buffered image when an action is called?

For example, if the buffered image is currently loading "Hand.png", I want to be able to press a button or a key, and have it load "Foot.png" instead. My action listeners and buffered image are set up correctly, I'm just unsure of the syntax required to change a BufferedImage.

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
  • You may be looking for `setPressedIcon()`; here's an [example](http://stackoverflow.com/a/4170233/230513) using `setRolloverIcon()`; see also [`ButtonGroupTest`](http://stackoverflow.com/a/6036048/230513), which uses a `JToggleButton`. – trashgod Jan 10 '13 at 19:52
  • For better help sooner, post an [SSCCE](http://sscce.org/). – Andrew Thompson Jan 11 '13 at 03:03

1 Answers1

0

don't change the image, create several images and display different images depending on events/actions

R.Moeller
  • 3,436
  • 1
  • 17
  • 12