Welcome to the new platform of Programmers Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use it's exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
Hi there every1
hav a bit of a problem that I cant work out. Doing a program that has many buttons that say the same thing "ok", but need then to perform different functions, only problem is that using .getActionCommand(), which seems to be the norm to use is actionPerformed(), it will come up with "ok" which natrually has problems for me cuz i then performs 8 different tasks each time i click it. Someone suggest that i use .getSource(). I tried this but when used with .equals() it doesnt work at all, i then tried converting to a string (.toString())(i also converted the stored one that i was comparing to so they were both in the same format) and using .compareTo() but if i use ==0 i get no result and i often land up having to use it giving a large room for error (e.g. compareTo()<5, but this then picks up other "ok" buttons. does ne1 hav ANY suggestions as to wat mite work???
All help would be greatly appreciated!