public ScreenshotDemo() {		
		MinuetoFont fontArial16;				// Font used to write framerate.
		MinuetoImage imageFramerate;			// Text use to display framerate.
		MinuetoStopWatch mswWatch;			// Timer used to calculate framerate.
		MinuetoColor color[] = new MinuetoColor[5];	// Array of color.
		
		Random ranNumGenerator;				// Our random number generator.
		
		double dFrameRate;					// Current framerate.
		int numberLines;					// Current number of lines drawn on screen.
		int frameCount;					// Used to calculate the framerate
		
		int i,j,k,x,y,c;					// Temporary integers.
		
		// Create a 640 by 480 window.
		window = new MinuetoFrame(640, 480, true);
		
		// Setup Mouse Handler
		eventQueue = new MinuetoEventQueue();
		window.registerMouseHandler(this, eventQueue);
		
		// Init random number generator.
		ranNumGenerator = new Random();		
		
		// Init the timer.
		mswWatch = new MinuetoStopWatch();
		
		// Init the font.
		fontArial16 = new MinuetoFont("Arial",16,false, false);
		
		// Prepare the color array.
		color[0] = MinuetoColor.BLACK;
		color[1] = MinuetoColor.RED;
		color[2] = MinuetoColor.GREEN;
		color[3] = MinuetoColor.BLUE;
		color[4] = MinuetoColor.WHITE;
									
		// Init the framerate text (so it's not null on the first frames).		
		imageFramerate = new MinuetoText("FPS: 0",fontArial16,MinuetoColor.BLUE);

		// Start the timer.
		mswWatch.start();
		
		// Get reday to count the FPS		
		frameCount = 0;
		
		// At first, we draw no lines
		numberLines = 0;
		
		// Show the game window.
		window.setVisible(true);
			
		// Game/Rendering loop	
		while(true) {

			while (eventQueue.hasNext()) {
				eventQueue.handle();
			}
		
			window.clear();
			
			// For every lines we are supposed to draw:
			for(i = 0; i < numberLines; i++) {
				j = ranNumGenerator.nextInt(640); //Starting X of the line.
				k = ranNumGenerator.nextInt(480); //Starting Y of the line.
				x = ranNumGenerator.nextInt(640); //Ending X of the line.
				y = ranNumGenerator.nextInt(480); //Ending Y of the line.
				c = ranNumGenerator.nextInt(5);	// Random color of the line.
				window.drawLine(color[c], j, k, x, y); // Draw the line.
			}
			
			// Count this frame
			frameCount++;
			// We update the framerate every thread frames.
			if (frameCount == 20) {
				mswWatch.stop();
				
				// Using the timer, we calculate how much time was needed to
				// draw the 20 frames. This gives us our framterate.
				dFrameRate =  (double)20000/(double)mswWatch.getTime();
				// If our FPS is > 31, then we add some lines.
				if (dFrameRate > 31.0) numberLines = numberLines + (int)Math.round(Math.abs(dFrameRate - 30.0));
				// If our FPS is < 29, then we remove some lines.
				if (dFrameRate < 29.0) numberLines--;
				
				//We build the image that will display the framerate and the line count.
				imageFramerate = new MinuetoText("FPS: " + dFrameRate + " Lines: " + numberLines ,fontArial16,MinuetoColor.BLUE);
				// And we start counting the frame agains ...
				frameCount = 0;
				// ...after having properly reset the counter.
				mswWatch.reset();
				mswWatch.start();

			}
			
			// We display the framerate and the line count
			window.draw(imageFramerate, 0, 0);
			
			// Render all graphics in the back buffer.			
			window.render();
		}
		
		
	}