Advertisement
Guest User

Untitled

a guest
Nov 13th, 2019
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. package lab6;
  2.  
  3. import java.awt.event.ActionEvent;
  4. import java.awt.event.ActionListener;
  5.  
  6. import javax.swing.JTextArea;
  7. import javax.swing.JTextField;
  8.  
  9. public class Adunare implements ActionListener{
  10. private JTextField tf1;
  11. private JTextField tf2;
  12. private JTextArea rez;
  13. public Adunare(JTextField tf1, JTextField tf2, JTextArea rez)
  14. {
  15. this.tf1=tf1;
  16. this.tf2=tf2;
  17. this.rez=rez;
  18. }
  19. public void actionPerformed(ActionEvent e)
  20. {
  21. int op1,op2;
  22. op1=Integer.parseInt(tf1.getText());
  23. op2=Integer.parseInt(tf2.getText());
  24. rez.append(String.valueOf(op1+op2)+"\n");
  25. }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement