Win a copy of Soft Skills: The software developer's life manual this week in the Jobs Discussion forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Adding Image to a button

 
chander shivdasani
Ranch Hand
Posts: 206
Eclipse IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to add an Image to a button once a button is pressed. To do that, i am using the following code:



The Problem is, whenever i am using setPressedIcon it does not display the image, but when i replace it by setIcon, it works.But i have to diable the button once it is pressed, so i do setEnabled(false), which changes the color of the image

How do i do this?
 
Maneesh Godbole
Saloon Keeper
Posts: 10967
11
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check out AbstractButton#setDisabledIcon()
 
pete stein
Bartender
Posts: 1561
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please read this link:

BeForthrightWhenCrossPostingToOtherSites
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic