Code example for Scanner

Methods: nextIntnextLine

	 * Fishpicture and moustache-center choosen from user input 
	public void createFishPic(){ 
		// Take user input 
		Scanner scanner = new Scanner (;
		System.out.println("Vilken fiskbild vill du rita en mustasch på?");
		String filename = scanner.nextLine();
		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);
Stop searching for code, let great code find you!  Add Codota to your java IDE