Code example for Scanner

Methods: nextInt, nextLine

0
	 * Fishpicture and moustache-center choosen from user input 
	 */ 
	public void createFishPic(){ 
		 
		// Take user input 
		Scanner scanner = new Scanner (System.in);
		 
		System.out.println("Vilken fiskbild vill du rita en mustasch på?");
		String filename = scanner.nextLine();
		System.out.println(filename);
		 
		System.out.println("Ange x och y-koordinater för mustaschens centrum");
		int x = scanner.nextInt();
		int y = scanner.nextInt();
		 
		// Take user input to create new ImagePanel 
		// Then add it to frame and display frame 
		Point mCenter = new Point(x, y);
		JFrame frame = new JFrame("En fisk med mustasch!");
		ImagePanel ip = new ImagePanel(filename, mCenter);
		ip.setPreferredSize(ip.getFishDimension());