さらに多くのパッケージをインポートし続けていますが、マウス イベントを含むすべてのメソッドで同じ「エラー: シンボルが見つかりません」というメッセージが表示されます。拡張または実装する必要があるパッケージまたはクラスが不足していると思いますが、どれが見つかりません。何か案は?
import java.awt.event.*;
import java.awt.BorderLayout;
import java.awt.Button;
import java.awt.Component;
import java.awt.Frame;
import java.awt.TextArea;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.*;
public class t1 implements MouseListener
{
public static void main(String[] args)
{
// Create frame with title
Frame frame = new Frame("Click Counter Project");
// Create a component to add to the frame
final TextArea textArea = new TextArea("Click");
}
public void mousePressed(MouseEvent event)
{
textArea.setText("Mouse pressed. x = "+ event.getX() + " y = " + event.getY());
}
public void mouseReleased(MouseEvent event)
{
textArea.setText("Mouse released. x = "+ event.getX() + " y = " + event.getY());
}
public void mouseClicked(MouseEvent event)
{
textArea.setText("Mouse clicked. x = "+ event.getX() + " y = " + event.getY());
}
public void mouseEntered(MouseEvent event)
{
textArea.setText("Mouse entered. x = "+ event.getX() + " y = " + event.getY());
}
public void mouseExited(MouseEvent event)
{
textArea.setText("Mouse exited. x = "+ event.getX() + " y = " + event.getY());
}
public void t1()
{
frame.add(textArea, BorderLayout.NORTH);
int width = 300;
int height = 300;
frame.setSize(width, height);
frame.setVisible(true);
}
}