public void updateImage() {
        if (GraphicsEnvironment.isHeadless()) {
            return;
        }

        // cache the focus so it'll know when it needs to redraw later.
        hasFocus = rb.getBlock().hasFocus();

        Color color = null;
        if (hColor != null) {
            color = hColor;
        } else if (rb.getBlock().hasFocus()) {
            color = new Color(200, 200, 255); //Color.BLUE);
        } else if (isSearchResult) {
            color = new Color(255, 255, 120); //Color.YELLOW);
        } else if (rb.getBlock().isBad()) {
            color = new Color(255, 100, 100); //Color.RED);
        } else {
            GraphicsManager.recycleGCCompatibleImage(hImage);
            hImage = null;
            return; // if we're not highlighting, destroy the image and just return
        }

        if (!rb.isVisible()) {
            GraphicsManager.recycleGCCompatibleImage(hImage);
            hImage = null;
            return; // if we're not highlighting, destroy the image and just return
        }

        hImage = GraphicsManager.getGCCompatibleImage(rb.getBlockWidth() + HIGHLIGHT_STROKE_WIDTH, rb.getBlockHeight() + HIGHLIGHT_STROKE_WIDTH);

        Graphics2D hg = (Graphics2D) hImage.getGraphics();
        hg.addRenderingHints(new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON));
        hg.setColor(color);
        hg.translate(HIGHLIGHT_STROKE_WIDTH / 2, HIGHLIGHT_STROKE_WIDTH / 2);
        hg.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, .2f));
        for (int i = 0; i < HIGHLIGHT_STROKE_WIDTH; i++) {
            hg.setStroke(new BasicStroke(i));
            hg.draw(rb.getBlockArea());
        }
        hg.setColor(new Color(0, 0, 0, 0));
        hg.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC, 1));
        hg.fill(rb.getBlockArea());
    }