All pastes #835712 Raw Edit

Nishant Shukla

public java v1 · immutable
#835712 ·published 2007-12-29 00:19 UTC
rendered paste body
//the code:import java.util.Scanner;import java.applet.*;import java.awt.*;import java.awt.event.*;public class point extends Applet implements MouseListener{	int clicks;	public void init()	{		Scanner kb = new Scanner(System.in);		System.out.println("How many times do you want to click?");		clicks = kb.nextInt();		int width = getSize().width;		int height = getSize().height;	    setBackground( Color.black );	    addMouseListener( this );   	}   	int x [] = new int [400];   	int y [] = new int [400];   	public void keyPressed( KeyEvent e ) { }	public void keyReleased( KeyEvent e ) { }	public void keyTyped( KeyEvent e ) { }	public void mouseEntered( MouseEvent e ) { }	public void mouseExited( MouseEvent e ) { }	public void mousePressed( MouseEvent e ) { }	public void mouseReleased( MouseEvent e ) { }	int cx=0;	int cy=0;	public void mouseClicked( MouseEvent e )	{		for(int i=0 ; i<clicks ; i++)		{			x[i] = e.getX();			y[i] = e.getY();			cx=x[i];			cy=y[i];			System.out.println(x[i]+", "+y[i]);			repaint();			e.consume();		}		System.out.println(cx+", "+cy);   	}}