protected void paintComponent(Graphics g) {
		
		super.paintComponent(g); // Paints the background
		
		if (image == null) {
			return;
		}
		
		if (scale == 0.0) {
			initializeParams();
		}
			
		if (isHighQualityRendering()) {			
			Rectangle rect = getImageClipBounds();
			if (rect == null || rect.width == 0 || rect.height == 0) { // no part of image is displayed in the panel
				return;
			}

			BufferedImage subimage = image.getSubimage(rect.x, rect.y, rect.width, 
				rect.height);
			Graphics2D g2 = (Graphics2D)g;
			g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, INTERPOLATION_TYPE);
			g2.drawImage(subimage, Math.max(0, originX), Math.max(0, originY), 
				Math.min((int)(subimage.getWidth() * scale), getWidth()), 
				Math.min((int)(subimage.getHeight() * scale), getHeight()), null);
		} else {
			g.drawImage(image, originX, originY, getScreenImageWidth(), 
				getScreenImageHeight(), null);
		}
		
		//Draw navigation image
		if (isNavigationImageEnabled()) {
			g.drawImage(navigationImage, 0, 0, getScreenNavImageWidth(),
				getScreenNavImageHeight(), null);
			drawZoomAreaOutline(g);
		}
	}