Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JButtons not buttons?  RSS feed

 
Al Hollis
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok i have built my game using jbuttons for ease of changing image icons dynmacially when i want them to change. However is there any way i can make these buttons not look act like buttons. E.g setting them to not be enabled without that grey wash over forming over the top of them?
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24215
37
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use JLabels instead of JButtons as your image holders.
 
Al Hollis
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
LOL that was so simple... Im now quite embarressed...

Thank you

[ May 10, 2006: Message edited by: Al Hollis ]
[ May 10, 2006: Message edited by: Al Hollis ]
 
Jeff Albertson
Ranch Hand
Posts: 1780
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you still want to use a JButton (for the L&F?), you call always explicitly set its disabled icon. When you don't, it creates one on the fly by graying out the given icon:
 
Al Hollis
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ahh, i didnt relise you could do that either..

Thanks again. Will come in handy!
 
Jeff Albertson
Ranch Hand
Posts: 1780
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not to beat a dead horse, but it's good to know that buttons (any subclass of AbstractButton) sports seven different icons:

icon (the normal one)
pressedIcon
selectedIcon
disabledIcon
disabledSelectedIcon
rolloverIcon
rolloverSelectedIcon

... with the obvious setter/getters.
 
Al Hollis
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank again very handy
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!