Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JButton Image Sprite  RSS feed

 
Cody Bissett
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
G'day everyone -

I've got an image sprite with four sections. I've also got four JButtons. The other day, I irretrievably deleted my piece of code which positioned the sprite as I wanted it in each button. Now, I've been looking for a while to find how I did it but can't for the life of me dig it up.

Any tips? It was not a long piece of code and had something to do with ImageIcon, if I recall correctly. Thanks ahead of time for your help.


Cody
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
 
Rob Camick
Ranch Hand
Posts: 2787
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


 
Cody Bissett
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Cheers guys, glad to be here.

Your examples put me on the right path, and I found what I did:



That'll let me use my single image sprite in several buttons.

Cody
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!