This week's book giveaway is in the General Computing forum. We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line! See this thread for details.
Would any body tell me that what is the function of setAction command in the following code. I got beet confuse about this command. Also i would like to know since getActionCommand is a method of Button class then How we r calling it with ActionEvent object.
setActionCommand sets the string that is part of the ActionEvent when the button is clicked. You use it to determine which action should take place in your actionPerformed method. The code looks fine, i.e. you're using the two methods correctly. (Of course, you set "Left", while you check for "left", so that wouldn't work.)