1468 lines · 48.9 KB · Java
RawDownload
            graphics.setColor(oldColor);        }        graphics.fillRoundRect(x, y, width, height, arcWidth, arcHeight);    }     /**     * Overrides <code>Graphics.drawLine</code>.     */    public void drawLine(int x1, int y1, int x2, int y2) {        DebugGraphicsInfo info = info();         if (debugLog()) {            info().log(toShortString() +                       " Drawing line: from " + pointToString(x1, y1) +                       " to " +  pointToString(x2, y2));        }         if (isDrawingBuffer()) {            if (debugBuffered()) {                Graphics debugGraphics = debugGraphics();                 debugGraphics.drawLine(x1, y1, x2, y2);                debugGraphics.dispose();            }        } else if (debugFlash()) {            Color oldColor = getColor();            int i, count = (info.flashCount * 2) - 1;             for (i = 0; i < count; i++) {                graphics.setColor((i % 2) == 0 ? info.flashColor : oldColor);                graphics.drawLine(x1, y1, x2, y2);                Toolkit.getDefaultToolkit().sync();                sleep(info.flashTime);            }            graphics.setColor(oldColor);        }        graphics.drawLine(x1, y1, x2, y2);    }     /**     * Overrides <code>Graphics.draw3DRect</code>.     */    public void draw3DRect(int x, int y, int width, int height,                           boolean raised) {        DebugGraphicsInfo info = info();         if (debugLog()) {            info().log(toShortString() +                       " Drawing 3D rect: " +                       new Rectangle(x, y, width, height) +                       " Raised bezel: " + raised);        }        if (isDrawingBuffer()) {            if (debugBuffered()) {                Graphics debugGraphics = debugGraphics();                 debugGraphics.draw3DRect(x, y, width, height, raised);                debugGraphics.dispose();            }        } else if (debugFlash()) {            Color oldColor = getColor();            int i, count = (info.flashCount * 2) - 1;             for (i = 0; i < count; i++) {                graphics.setColor((i % 2) == 0 ? info.flashColor : oldColor);                graphics.draw3DRect(x, y, width, height, raised);                Toolkit.getDefaultToolkit().sync();                sleep(info.flashTime);            }            graphics.setColor(oldColor);        }        graphics.draw3DRect(x, y, width, height, raised);    }     /**     * Overrides <code>Graphics.fill3DRect</code>.     */    public void fill3DRect(int x, int y, int width, int height,                           boolean raised) {        DebugGraphicsInfo info = info();         if (debugLog()) {            info().log(toShortString() +                       " Filling 3D rect: " +                       new Rectangle(x, y, width, height) +                       " Raised bezel: " + raised);        }        if (isDrawingBuffer()) {            if (debugBuffered()) {                Graphics debugGraphics = debugGraphics();                 debugGraphics.fill3DRect(x, y, width, height, raised);                debugGraphics.dispose();            }        } else if (debugFlash()) {            Color oldColor = getColor();            int i, count = (info.flashCount * 2) - 1;             for (i = 0; i < count; i++) {                graphics.setColor((i % 2) == 0 ? info.flashColor : oldColor);                graphics.fill3DRect(x, y, width, height, raised);                Toolkit.getDefaultToolkit().sync();                sleep(info.flashTime);            }            graphics.setColor(oldColor);        }        graphics.fill3DRect(x, y, width, height, raised);    }     /**     * Overrides <code>Graphics.drawOval</code>.     */    public void drawOval(int x, int y, int width, int height) {        DebugGraphicsInfo info = info();         if (debugLog()) {            info().log(toShortString() +                      " Drawing oval: " +                      new Rectangle(x, y, width, height));        }        if (isDrawingBuffer()) {            if (debugBuffered()) {                Graphics debugGraphics = debugGraphics();                 debugGraphics.drawOval(x, y, width, height);                debugGraphics.dispose();            }        } else if (debugFlash()) {            Color oldColor = getColor();            int i, count = (info.flashCount * 2) - 1;             for (i = 0; i < count; i++) {                graphics.setColor((i % 2) == 0 ? info.flashColor : oldColor);                graphics.drawOval(x, y, width, height);                Toolkit.getDefaultToolkit().sync();                sleep(info.flashTime);            }            graphics.setColor(oldColor);        }        graphics.drawOval(x, y, width, height);    }     /**     * Overrides <code>Graphics.fillOval</code>.     */    public void fillOval(int x, int y, int width, int height) {        DebugGraphicsInfo info = info();         if (debugLog()) {            info().log(toShortString() +                      " Filling oval: " +                      new Rectangle(x, y, width, height));        }        if (isDrawingBuffer()) {            if (debugBuffered()) {                Graphics debugGraphics = debugGraphics();                 debugGraphics.fillOval(x, y, width, height);                debugGraphics.dispose();            }        } else if (debugFlash()) {            Color oldColor = getColor();            int i, count = (info.flashCount * 2) - 1;             for (i = 0; i < count; i++) {                graphics.setColor((i % 2) == 0 ? info.flashColor : oldColor);                graphics.fillOval(x, y, width, height);                Toolkit.getDefaultToolkit().sync();                sleep(info.flashTime);            }            graphics.setColor(oldColor);        }        graphics.fillOval(x, y, width, height);    }     /**     * Overrides <code>Graphics.drawArc</code>.     */    public void drawArc(int x, int y, int width, int height,                        int startAngle, int arcAngle) {        DebugGraphicsInfo info = info();         if (debugLog()) {            info().log(toShortString() +                      " Drawing arc: " +                      new Rectangle(x, y, width, height) +                      " startAngle: " + startAngle +                      " arcAngle: " + arcAngle);        }        if (isDrawingBuffer()) {            if (debugBuffered()) {                Graphics debugGraphics = debugGraphics();                 debugGraphics.drawArc(x, y, width, height,                                      startAngle, arcAngle);                debugGraphics.dispose();            }        } else if (debugFlash()) {            Color oldColor = getColor();            int i, count = (info.flashCount * 2) - 1;             for (i = 0; i < count; i++) {                graphics.setColor((i % 2) == 0 ? info.flashColor : oldColor);                graphics.drawArc(x, y, width, height, startAngle, arcAngle);                Toolkit.getDefaultToolkit().sync();                sleep(info.flashTime);            }            graphics.setColor(oldColor);        }        graphics.drawArc(x, y, width, height, startAngle, arcAngle);    }     /**     * Overrides <code>Graphics.fillArc</code>.     */    public void fillArc(int x, int y, int width, int height,                        int startAngle, int arcAngle) {        DebugGraphicsInfo info = info();         if (debugLog()) {            info().log(toShortString() +                      " Filling arc: " +                      new Rectangle(x, y, width, height) +                      " startAngle: " + startAngle +                      " arcAngle: " + arcAngle);        }        if (isDrawingBuffer()) {            if (debugBuffered()) {                Graphics debugGraphics = debugGraphics();                 debugGraphics.fillArc(x, y, width, height,                                      startAngle, arcAngle);                debugGraphics.dispose();            }        } else if (debugFlash()) {            Color oldColor = getColor();            int i, count = (info.flashCount * 2) - 1;             for (i = 0; i < count; i++) {                graphics.setColor((i % 2) == 0 ? info.flashColor : oldColor);                graphics.fillArc(x, y, width, height, startAngle, arcAngle);                Toolkit.getDefaultToolkit().sync();                sleep(info.flashTime);            }            graphics.setColor(oldColor);        }        graphics.fillArc(x, y, width, height, startAngle, arcAngle);    }     /**     * Overrides <code>Graphics.drawPolyline</code>.     */    public void drawPolyline(int xPoints[], int yPoints[], int nPoints) {        DebugGraphicsInfo info = info();         if (debugLog()) {            info().log(toShortString() +                      " Drawing polyline: " +                      " nPoints: " + nPoints +                      " X's: " + xPoints +                      " Y's: " + yPoints);        }        if (isDrawingBuffer()) {            if (debugBuffered()) {                Graphics debugGraphics = debugGraphics();                 debugGraphics.drawPolyline(xPoints, yPoints, nPoints);                debugGraphics.dispose();            }        } else if (debugFlash()) {            Color oldColor = getColor();            int i, count = (info.flashCount * 2) - 1;             for (i = 0; i < count; i++) {                graphics.setColor((i % 2) == 0 ? info.flashColor : oldColor);                graphics.drawPolyline(xPoints, yPoints, nPoints);                Toolkit.getDefaultToolkit().sync();                sleep(info.flashTime);            }            graphics.setColor(oldColor);        }        graphics.drawPolyline(xPoints, yPoints, nPoints);    }     /**     * Overrides <code>Graphics.drawPolygon</code>.     */    public void drawPolygon(int xPoints[], int yPoints[], int nPoints) {        DebugGraphicsInfo info = info();         if (debugLog()) {            info().log(toShortString() +                      " Drawing polygon: " +                      " nPoints: " + nPoints +                      " X's: " + xPoints +                      " Y's: " + yPoints);        }        if (isDrawingBuffer()) {            if (debugBuffered()) {                Graphics debugGraphics = debugGraphics();                 debugGraphics.drawPolygon(xPoints, yPoints, nPoints);                debugGraphics.dispose();            }        } else if (debugFlash()) {            Color oldColor = getColor();            int i, count = (info.flashCount * 2) - 1;             for (i = 0; i < count; i++) {                graphics.setColor((i % 2) == 0 ? info.flashColor : oldColor);                graphics.drawPolygon(xPoints, yPoints, nPoints);                Toolkit.getDefaultToolkit().sync();                sleep(info.flashTime);            }            graphics.setColor(oldColor);        }        graphics.drawPolygon(xPoints, yPoints, nPoints);    }     /**     * Overrides <code>Graphics.fillPolygon</code>.     */    public void fillPolygon(int xPoints[], int yPoints[], int nPoints) {        DebugGraphicsInfo info = info();         if (debugLog()) {            info().log(toShortString() +                      " Filling polygon: " +                      " nPoints: " + nPoints +                      " X's: " + xPoints +                      " Y's: " + yPoints);        }        if (isDrawingBuffer()) {            if (debugBuffered()) {                Graphics debugGraphics = debugGraphics();                 debugGraphics.fillPolygon(xPoints, yPoints, nPoints);                debugGraphics.dispose();            }        } else if (debugFlash()) {            Color oldColor = getColor();            int i, count = (info.flashCount * 2) - 1;             for (i = 0; i < count; i++) {                graphics.setColor((i % 2) == 0 ? info.flashColor : oldColor);                graphics.fillPolygon(xPoints, yPoints, nPoints);                Toolkit.getDefaultToolkit().sync();                sleep(info.flashTime);            }            graphics.setColor(oldColor);        }        graphics.fillPolygon(xPoints, yPoints, nPoints);    }     /**     * Overrides <code>Graphics.drawString</code>.     */    public void drawString(String aString, int x, int y) {        DebugGraphicsInfo info = info();         if (debugLog()) {            info().log(toShortString() +                       " Drawing string: \"" + aString +                       "\" at: " + new Point(x, y));        }         if (isDrawingBuffer()) {            if (debugBuffered()) {                Graphics debugGraphics = debugGraphics();                 debugGraphics.drawString(aString, x, y);                debugGraphics.dispose();            }        } else if (debugFlash()) {            Color oldColor = getColor();            int i, count = (info.flashCount * 2) - 1;             for (i = 0; i < count; i++) {                graphics.setColor((i % 2) == 0 ? info.flashColor                                  : oldColor);                graphics.drawString(aString, x, y);                Toolkit.getDefaultToolkit().sync();                sleep(info.flashTime);            }            graphics.setColor(oldColor);        }        graphics.drawString(aString, x, y);    }     /**     * Overrides <code>Graphics.drawString</code>.     */    public void drawString(AttributedCharacterIterator iterator, int x, int y) {        DebugGraphicsInfo info = info();         if (debugLog()) {            info().log(toShortString() +                       " Drawing text: \"" + iterator +                       "\" at: " + new Point(x, y));        }         if (isDrawingBuffer()) {            if (debugBuffered()) {                Graphics debugGraphics = debugGraphics();                 debugGraphics.drawString(iterator, x, y);                debugGraphics.dispose();            }        } else if (debugFlash()) {            Color oldColor = getColor();            int i, count = (info.flashCount * 2) - 1;             for (i = 0; i < count; i++) {                graphics.setColor((i % 2) == 0 ? info.flashColor                                  : oldColor);                graphics.drawString(iterator, x, y);                Toolkit.getDefaultToolkit().sync();                sleep(info.flashTime);            }            graphics.setColor(oldColor);        }        graphics.drawString(iterator, x, y);    }     /**     * Overrides <code>Graphics.drawBytes</code>.     */    public void drawBytes(byte data[], int offset, int length, int x, int y) {        DebugGraphicsInfo info = info();         Font font = graphics.getFont();         if (debugLog()) {            info().log(toShortString() +                       " Drawing bytes at: " + new Point(x, y));        }         if (isDrawingBuffer()) {            if (debugBuffered()) {                Graphics debugGraphics = debugGraphics();                 debugGraphics.drawBytes(data, offset, length, x, y);                debugGraphics.dispose();            }        } else if (debugFlash()) {            Color oldColor = getColor();            int i, count = (info.flashCount * 2) - 1;             for (i = 0; i < count; i++) {                graphics.setColor((i % 2) == 0 ? info.flashColor                                  : oldColor);                graphics.drawBytes(data, offset, length, x, y);                Toolkit.getDefaultToolkit().sync();                sleep(info.flashTime);            }            graphics.setColor(oldColor);        }        graphics.drawBytes(data, offset, length, x, y);    }     /**     * Overrides <code>Graphics.drawChars</code>.     */    public void drawChars(char data[], int offset, int length, int x, int y) {        DebugGraphicsInfo info = info();         Font font = graphics.getFont();         if (debugLog()) {            info().log(toShortString() +                       " Drawing chars at " +  new Point(x, y));        }         if (isDrawingBuffer()) {            if (debugBuffered()) {                Graphics debugGraphics = debugGraphics();                 debugGraphics.drawChars(data, offset, length, x, y);                debugGraphics.dispose();            }        } else if (debugFlash()) {            Color oldColor = getColor();            int i, count = (info.flashCount * 2) - 1;             for (i = 0; i < count; i++) {                graphics.setColor((i % 2) == 0 ? info.flashColor                                  : oldColor);                graphics.drawChars(data, offset, length, x, y);                Toolkit.getDefaultToolkit().sync();                sleep(info.flashTime);            }            graphics.setColor(oldColor);        }        graphics.drawChars(data, offset, length, x, y);    }     /**     * Overrides <code>Graphics.drawImage</code>.     */    public boolean drawImage(Image img, int x, int y,

Lines 501–1000 of 1468. Previous lines