import java.awt.*; import java.awt.event.*; import javax.swing.*; public class GrVaatleja1 extends JPanel implements MouseListener{ Loendaja andmetalleti=new PiiksuvLoendaja(); public GrVaatleja1(){ addMouseListener(this); } public void mousePressed(MouseEvent e){ andmetalleti.lisa(); } public void mouseReleased(MouseEvent e){} public void mouseClicked(MouseEvent e){} public void mouseEntered(MouseEvent e){} public void mouseExited(MouseEvent e){} public static void main(String[] arg){ JFrame f=new JFrame(); f.getContentPane().add(new GrVaatleja1()); f.setSize(300, 300); f.setVisible(true); } }