Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.*;
- import java.awt.event.*;
- public class option1 extends Frame {
- option1() {
- setTitle("Final Project Option 1");
- setSize(300,300);
- show();
- }
- public static void main(String[] args) {
- option1 test = new option1();
- int a = 0;
- String s1 = "" + a;
- Frame objFrame;
- Button objButton1;
- Label objLabel1;
- objFrame = new option1();
- objButton1 = new Button("Button");
- objLabel1 = new Label();
- objLabel1.setBounds(150,220,50,30);
- objButton1.setBounds(40,35,50,50);
- objLabel1.setText(s1);
- objButton1.addMouseListener(new MyMouseListener()); //line 29
- objFrame.add(objLabel1);
- objFrame.add(objButton1);
- }
- public class MyMouseListener extends MouseAdapter {
- public void mouseClicked(MouseEvent me) {
- a++; //line 36
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement