int baseBarLength = 23; int barLength = 0; double percentRemaining = 0.00;  percentRemaining = entity.getArmorRemainingPercent(); barLength = (int)(baseBarLength * percentRemaining);  graph.setColor(Color.darkGray); graph.fillRect(56, 7, 23, 3); graph.setColor(Color.lightGray); graph.fillRect(55, 6, 23, 3); graph.setColor(getStatusBarColor(percentRemaining)); graph.fillRect(55, 6, barLength, 3);  percentRemaining = entity.getInternalRemainingPercent(); barLength = (int)(baseBarLength * percentRemaining);  graph.setColor(Color.darkGray); graph.fillRect(56, 11, 23, 3); graph.setColor(Color.lightGray); graph.fillRect(55, 10, 23, 3); graph.setColor(getStatusBarColor(percentRemaining)); graph.fillRect(55, 10, barLength, 3);
        public void draw() {            // figure out size            String model = entity.getModel();            Font font = new Font("SansSerif", Font.PLAIN, 10);            Rectangle modelRect = new Rectangle(47, 55,                                   getFontMetrics(font).stringWidth(model) + 1,                                  getFontMetrics(font).getAscent());            Rectangle wholeRect = new Rectangle(HEX_SIZE).union(modelRect);                        // create image for buffer            Image tempImage;            Graphics graph;            try {                tempImage = createImage(bounds.width, bounds.height);                graph = tempImage.getGraphics();            } catch (NullPointerException ex) {                // argh!  but I want it!                return;            }                        // fill with key color            graph.setColor(new Color(TRANSPARENT));            graph.fillRect(0, 0, bounds.width, bounds.height);                        // draw entity image            graph.drawImage(getEntityImage(entity), 0, 0, this);                        // draw box with model            Color col;            Color bcol;            if (entity.isImmobile()) {                col = Color.black;                bcol = Color.lightGray;            } else if (!entity.ready) {                col = Color.darkGray;                bcol = Color.black;            } else {                col = Color.lightGray;                bcol = Color.darkGray;            }            graph.setFont(font);            graph.setColor(bcol);            graph.fillRect(modelRect.x, modelRect.y, modelRect.width, modelRect.height);            modelRect.translate(-1, -1);            graph.setColor(col);            graph.fillRect(modelRect.x, modelRect.y, modelRect.width, modelRect.height);            graph.setColor(entity.ready ? Color.black : Color.lightGray);            graph.drawString(model, modelRect.x + 1, modelRect.y + modelRect.height - 1);                        // draw facing            graph.setColor(Color.white);            if (entity.getFacing() != -1) {                graph.drawPolygon(facingPolys[entity.getFacing()]);            }                        // draw condition strings            if (entity.isImmobile() && !entity.isProne()) {                // draw "IMMOBILE"                graph.setColor(Color.darkGray);                graph.drawString("IMMOBILE", 18, 39);                graph.setColor(Color.red);                graph.drawString("IMMOBILE", 17, 38);            } else if (!entity.isImmobile() && entity.isProne()) {                // draw "PRONE"                graph.setColor(Color.darkGray);                graph.drawString("PRONE", 26, 39);                graph.setColor(Color.yellow);                graph.drawString("PRONE", 25, 38);            } else if (entity.isImmobile() && entity.isProne()) {                // draw "IMMOBILE" and "PRONE"                graph.setColor(Color.darkGray);                graph.drawString("IMMOBILE", 18, 35);                graph.drawString("PRONE", 26, 48);                graph.setColor(Color.red);                graph.drawString("IMMOBILE", 17, 34);                graph.setColor(Color.yellow);                graph.drawString("PRONE", 25, 47);            }                            // create final image            this.image = createImage(new FilteredImageSource(tempImage.getSource(),                    new KeyAlphaFilter(TRANSPARENT)));        }