EDIT: I have fixed the problem. Thank you all for your help.
I am pretty new to programming, and have been struggling through an online course. I am now working on my final project, which is to: Write a program to count the number of mouse clicks on a button within a frame. The code I have seems to be WAY off. Keep in mind that this is an applet. Here is the program:
import java.awt.*;
import java.awt.event.*;
import java.awt.MouseAdapter;
public class finalproject1
{
TextField objTextField1;
public static void main(String[] args)
{
finalproject1 p1 = new finalproject1();
}
public finalproject1
{
Frame f = new Frame("Mouse Clicks");
objTextField1 = new TextField("Click the button",200);
objTextField1.setBounds(220,140,200,40);
Button button1 = new Button("Click here");
button1.setBounds(200,200,140,140);
button1.addMouseListener(new MouseAdapter()
{
public void mouseClicked(MouseEvent evt)
{
if(evt.getClickCount() == 3)
{
objTextField1TextField1.setText("Triple click");
}
else if(evt.getClickCount() ==2)
{
objTextField1.setText("Double click");
}
});
}
f.add(button1);
f.add(objTextField1);
f.addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent we)
{
System.exit(0);
}
});
f.setSize(800,800);
f.setVisible(true);
}
}