public void draw(final Graphics g, final int x, final int y, final int height) {

    Preconditions.checkNotNull(g, "Error: Graphics context can't be null");

    if (isVisible()) {

      // Save the old color.
      final Color oldColor = g.getColor();

      // Draw the caret
      g.setColor(m_caretColor);
      g.drawLine(x, y, x, (y + height) - 1);

      // Restore the old color.
      g.setColor(oldColor);
    }
  }
Draws the caret on a given graphics surface.

@param g The graphics surface where the caret is drawn.
@param x The x coordinate of the caret.
@param y The y coordinate of the caret.
@param height The height of the caret.
@throws NullPointerException Thrown if the graphics context is null.
java/zylib/src/main/java/com/google/security/zynamics/zylib/gui/JCaret/JCaret.java