• Post Reply Bookmark Topic Watch Topic
  • New Topic

labels and events  RSS feed

 
david allen
Ranch Hand
Posts: 185
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am working on a uni assignment and we have to make a calculator using labels. I am having troulbe associating a mouce click with a label.
Can this be done and if so how???
thank you david
 
Chantal Ackermann
Ranch Hand
Posts: 508
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
attach a MouseListener to the labels:
label.addMouseListener(new MouseAdapter()
{
/* implement the interface methods:
* the code that shall be executed in reaction
* on mouse events.
*/
});
this method is inherited from java.awt.Component.
chantal
 
david allen
Ranch Hand
Posts: 185
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you for that it is now working fine
david
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!