@Override
	protected void paintComponent(Graphics graphics) {
		super.paintComponent(graphics);
		BufferedImage off = new BufferedImage(getWidth(), getHeight(), TYPE_4BYTE_ABGR);
		Graphics buffer = off.getGraphics();
		if (image != null) {
			int targetWidth = getWidth();
			int targetHeight = getWidth();
			double proportion = countProportion(image);
			if (proportion > 1.0) {
				targetHeight *= 1 / proportion;
			} else {
				targetWidth *= 1 / proportion;
			}
			scaledInstance = image.getScaledInstance(targetWidth, targetHeight, Image.SCALE_SMOOTH);
			buffer.drawImage(scaledInstance, 0, 0, null);
			if (paintNewFrame) {
				rdm.setColor(new Color(200, 200, 200, 200));
				rdm.paintRectangle(buffer, startX, startY, currentX, currentY);
			}
		}
		if (selectedScreen != null) {
			Collection<Frame> frames = selectedScreen.getFrames();
			if (!frames.isEmpty()) {
				for (Frame frame : frames) {
					if (frame.isVisible()) {
						int scaledInstanceWidth = scaledInstance.getWidth(null);
						int scaledInstanceHeight = scaledInstance.getHeight(null);
						int sx = fsc.calculateSize(frame.getStartX(), scaledInstanceWidth);
						int w = fsc.calculateSize(frame.getSizeX(), scaledInstanceWidth);
						int sy = fsc.calculateSize(frame.getStartY(), scaledInstanceHeight);
						int h = fsc.calculateSize(frame.getSizeY(), scaledInstanceHeight);

						rdm.setColor(new Color(130, 130, 130, 100));
						rdm.paintFrame(buffer, sx, sy, w, h);
						rdm.paintFrameNumber(frame.getId() + "", buffer, sx, sy, w, h);
					}
				}
			}
		}
		graphics.drawImage(off, 0, 0, null);
		buffer.dispose();
	}