kindly tell me the coding for "=" button | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

kindly tell me the coding for "=" button

I am writing the coding of CALCULATOR in Java.

4th Apr 2019, 6:27 PM
Ammar Abbasi
Ammar Abbasi - avatar
1 Answer
0
If i understood you right.. For the first you need to implement the ActionListener interface. Then add this into your method: public void actionPerformed(ActionEvent e){ if(e.getSource() == yourButton){ // do something } } And in your main method add the action to your button: YourButton.addActionListener(this);
4th Apr 2019, 7:49 PM
JavaBobbo
JavaBobbo - avatar