• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Button

 
Maha Pratap
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey,
Does JButton object recognise item events?, 'coz in my application I want to have a button which should display some results depending upon the state of the button(selected or deselected). I know I can use check box instead of button but ... could some one help me in clearing my fundas? ... thanks ..
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
MahaPratap,
Welcome to JavaRanch!
We ain't got many rules 'round these parts, but we do got one. Please change your display name to comply with The JavaRanch Naming Policy.
Thanks Pardner! Hope to see you 'round the Ranch!
 
meera sood
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi!
the jbutton has built-in functions for the same.
eg.
jbutton go = new JButton();
then you have methods to set the icon of the image according to the event:
eg
go.setSelectedIcon(Icon);
go.setRolloverIcon(Icon);
go.setPressedIcon(Icon);
and so on... check the java documentation for a full list of methods...
hope this helps...
meera
 
Maha Pratap
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey meera,
When I say "display" some results , I mean to say that some other check boxes should change state according to the state of the button and not exactly *display * some icons or images.. Thanks ..
 
meera sood
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
oops sorry..... got u wrong!!!
anyways, wouldn't a click make the button selected???...just a thought...
meera
[ June 20, 2002: Message edited by: meera sood ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic