Advertisement
Guest User

Untitled

a guest
Dec 20th, 2014
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. import java.awt.*;
  2. import java.awt.event.*;
  3.  
  4. public class option1 extends Frame {
  5. option1() {
  6. setTitle("Final Project Option 1");
  7. setSize(300,300);
  8. show();
  9. }
  10. public static void main(String[] args) {
  11. option1 test = new option1();
  12.  
  13. int a = 0;
  14. String s1 = "" + a;
  15.  
  16. Frame objFrame;
  17. Button objButton1;
  18. Label objLabel1;
  19.  
  20. objFrame = new option1();
  21. objButton1 = new Button("Button");
  22. objLabel1 = new Label();
  23.  
  24. objLabel1.setBounds(150,220,50,30);
  25. objButton1.setBounds(40,35,50,50);
  26.  
  27. objLabel1.setText(s1);
  28.  
  29. objButton1.addMouseListener(new MyMouseListener()); //line 29
  30.  
  31. objFrame.add(objLabel1);
  32. objFrame.add(objButton1);
  33. }
  34. public class MyMouseListener extends MouseAdapter {
  35. public void mouseClicked(MouseEvent me) {
  36. a++; //line 36
  37. }
  38. }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement