public void update(Graphics g) {

		Graphics2D g2 = (Graphics2D) g;

		dim = getSize();

		if (isOpaque()) {
			g2.setColor(getBackground());
			g2.fillRect(0, 0, dim.width, dim.height);
		}

		g2.setColor(getForeground());
		g2.setStroke(ViewAttribute.THICK);

		int period = dim.width / 2;
		int zerox = dim.width / 10;
		int zeroy = dim.height / 10;

		ymin = dim.height / 4;
		ymax = dim.height - zeroy;
		scale = max / (ymax - ymin);

		if (v1 < 0.0f)
			v1 = dim.height * 0.1f;
		v2 = v1 + heat / scale;

		g2.setStroke(ViewAttribute.THIN);

		line.reset();
		line.moveTo(zerox, ymin + v1);

		int i;
		double alpha = Math.PI * 2.0 / period;
		for (i = period / 2; i < period; i++) {
			line.lineTo(i, ymin + 0.5f * v1 - (float) (Math.cos(alpha * i) * v1 * 0.5));
		}
		for (i = period; i < period / 2 * 3 + 1; i++) {
			line.lineTo(i, ymin + 0.5f * v2 - (float) (Math.cos(alpha * i) * v2 * 0.5));
		}
		line.lineTo(dim.width - zerox, ymin + v2);
		line.lineTo(dim.width - zerox, dim.height - zeroy);
		line.lineTo(zerox, dim.height - zeroy);
		line.closePath();
		Color c = isEnabled() ? barrierColor : getForeground().brighter();
		g2.setPaint(PatternFactory.createPattern(PatternFactory.DENSITY50, 4, 4, Color.white, c));
		g2.fill(line);

		g2.setColor(getForeground());
		line.reset();
		line.moveTo(zerox, ymin + v1);
		for (i = period / 2; i < period; i++) {
			line.lineTo(i, ymin + 0.5f * v1 - (float) (Math.cos(alpha * i) * v1 * 0.5));
		}
		for (i = period; i < period / 2 * 3 + 1; i++) {
			line.lineTo(i, ymin + 0.5f * v2 - (float) (Math.cos(alpha * i) * v2 * 0.5));
		}
		line.lineTo(dim.width - zerox, ymin + v2);
		g2.draw(line);
		g2.drawLine(zerox, zeroy, zerox, dim.height - zeroy);
		g2.drawLine(zerox, zeroy, zerox - 2, zeroy + 5);
		g2.drawLine(zerox, zeroy, zerox + 2, zeroy + 5);
		g2.drawLine(zerox, dim.height - zeroy, dim.width - 10, dim.height - zeroy);
		g2.drawLine(dim.width - 10, dim.height - zeroy, dim.width - 15, dim.height - zeroy - 2);
		g2.drawLine(dim.width - 10, dim.height - zeroy, dim.width - 15, dim.height - zeroy + 2);

		int p1x = period / 2 - 10;
		int p1y = (int) (ymin + v1);
		int p2x = period + p1x + 20;

		g2.setFont(ViewAttribute.LITTLE_FONT);
		if (reaction != null)
			g.drawString(reaction.toString(), 5, 10);
		g2.setColor(getForeground());

		FontMetrics fm = g2.getFontMetrics();
		int w = fm.stringWidth("Reaction Coordinate");
		int sx = (dim.width - w) / 2;
		int sy = dim.height - 5;
		g2.drawString("Reaction Coordinate", sx, sy);

		w = fm.stringWidth(thermic);
		g2.drawString(thermic, (int) ((period - w) * 0.5f), ymin - 5);
		g2.drawString("Chemical Potential = " + format.format(heat), period / 2, ymin - 25);

		g2.drawLine(p1x - 5, ymin, (p1x + p2x) / 2, ymin);
		w = fm.stringWidth("Activation Energy");
		sx = p1x + 4;
		sy = (int) ((p1y + ymin) * 0.5f);
		g2.drawString("Activation Energy", sx, sy);
		int hs = fm.getHeight();
		String s = format.format(getActivationEnergy()) + " eV";
		sy += hs;
		sx += (w - fm.stringWidth(s)) / 2;
		g2.drawString(s, sx, sy);
		g2.drawLine(p1x, p1y - ControlPoint.PT_SIZE, p1x, ymin);
		g2.drawLine(p1x, p1y - ControlPoint.PT_SIZE, p1x - 2, p1y - 2 - ControlPoint.PT_SIZE);
		g2.drawLine(p1x, p1y - ControlPoint.PT_SIZE, p1x + 2, p1y - 2 - ControlPoint.PT_SIZE);
		g2.drawLine(p1x, ymin, p1x - 2, ymin + 2);
		g2.drawLine(p1x, ymin, p1x + 2, ymin + 2);

		p1.x = p1x;
		p1.y = p1y;
		p1.paint(g2);

		w = fm.stringWidth("Energy");
		sx = zerox - fm.getHeight() / 2;
		sy = (dim.height + w) / 2;
		g2.rotate(Math.PI * 1.5, sx, sy);
		g2.drawString("Energy", sx, sy);
		g2.rotate(-Math.PI * 1.5, sx, sy);

	}