View Single Post
12-26-2007, 11:51 AM
#2
Dr John is offline Dr John
Status: Junior Member
Join date: May 2005
Location:
Expertise:
Software:
 
Posts: 77
iTrader: 0 / 0%
 

Dr John is on a distinguished road

  Old

I've had to look at some code I work two years ago, as I haven't used Java since then (and Java is NOT JavaScript)

Where you have your public void actionPerformed(ActionEvent e)
(which is inside the class that implements the actionListener),
you have inside it a series of IFs

eg
if (e.getSource() == bBars)
{some thing to do}
if(e.getSource() == bLines)
{some other things to do}
if(e.getSource() == bPies)
{even more things to do}
if(e.getSource() == bExit)
{guess what this did next}

Where each bSomething was an instance of a button, in this case ones for drawing graphs. BUT I'm very out of practice with Java, so even though I was very good at it back then, I'm a bit limited in what I can remember now. Strangely, I was top of the class but never actually liked Java.