public void paintComponent(Graphics g) {
            if (m_fainted) {
                g.drawImage(m_image, 0, 0, null);
                return;
            }
            updateIcon();
            Graphics2D g2 = (Graphics2D)g.create();
            if (m_pokemon.getState() == State.FAINTED) {
                BufferedImage img = createBufferedImage(m_image);
                RescaleOp rop = new RescaleOp(1f, -128f, null);
                ColorConvertOp cop = new ColorConvertOp(
                        ColorSpace.getInstance(ColorSpace.CS_GRAY), null);
                img = rop.filter(img, img);
                img = cop.filter(img, img);
                m_fainted = true;
                m_image = img;
                g2.drawImage(img, 0, 0, null);
                g2.dispose();
                return;
            }

            g2.drawImage(m_image, 0, 0, null);
            Image img = m_pokemon.getState().getImage();
            if (img != null) {
                g2.drawImage(img, 0, 24, null);
            }
            
            if (m_pokemon.getName() != null) {
                double frac = (double)m_pokemon.getNumerator() /
                        m_pokemon.getDenominator();
                int height = (int)(frac * 10);
                if (frac > 0 && height == 0) {
                    height = 1;
                }
                g2.setColor(new Color(32, 32, 32));
                g2.fillRect(27, 20, 5, 12);
                Color color = (frac > 0.5) ? GREEN
                        : (frac > 0.15) ? YELLOW : RED;
                g2.setColor(color);
                g2.fillRect(28, 31 - height, 3, height);
            }
            g2.dispose();
        }