public void paintComponent(Graphics g) {
		g.setColor(backgroundColor);
		g.drawRect(0, 0, getWidth(), getHeight());
		
		Graphics2D g2d = (Graphics2D)g;
		g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                RenderingHints.VALUE_ANTIALIAS_ON);
		
		g.setColor(Color.black);
	
		if (!frequenciesSet) {
			return;
		}
		
		g.setFont(font);
		FontMetrics fm = g.getFontMetrics();
		double actualHeight = fm.getAscent()*0.75;
		
		
		int targetHeight = getHeight();	//The final height of all all the stacked bases
		if (showPosition)
			targetHeight -= positionLabelHeight+3;
		
		int gap = 1;	//Y-gap separating the drawn bases
		double scale = (targetHeight-6*gap) / actualHeight; //Scaling coefficient
		
		int prevHeight = 0;
		for(int i=0; i<4; i++) {
			transform.setToIdentity();
			String base = String.valueOf(charForInt(i));
			double mod = 1.0;
			if (base.equals("C") || base.equals("G"))
				mod = 0.98;
			else
				mod = 1.02;
			transform.scale(1.0, mod*scale*freqs[i]);
			g.setColor(colorForInt(i));
			Font derivedFont = font.deriveFont(transform);
			g.setFont(derivedFont);
			fm = g.getFontMetrics();
			
			double realHeight = fm.getAscent()*0.75;
			if (base.equals("C") || base.equals("G"))
				prevHeight += realHeight+gap;
			else
				prevHeight += realHeight+2*gap;
			g.drawString(base, 1, prevHeight);
		}
		
		if (showPosition) {
			g.setColor(Color.gray);
			g.drawLine(0, getHeight()-positionLabelHeight, getWidth(), getHeight()-positionLabelHeight);
			g2d.setFont(posFont);
			fm = g2d.getFontMetrics();
			int posWidth = fm.stringWidth(positionLabel);
			g2d.drawString(positionLabel, getWidth()/2-posWidth/2, getHeight()-1);
		}
		g.setColor(backgroundColor);
	}