1 /*
2 * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
753 debugGraphics.dispose();
754 }
755 } else if (debugFlash()) {
756 Color oldColor = getColor();
757 int i, count = (info.flashCount * 2) - 1;
758
759 for (i = 0; i < count; i++) {
760 graphics.setColor((i % 2) == 0 ? info.flashColor : oldColor);
761 graphics.fillArc(x, y, width, height, startAngle, arcAngle);
762 Toolkit.getDefaultToolkit().sync();
763 sleep(info.flashTime);
764 }
765 graphics.setColor(oldColor);
766 }
767 graphics.fillArc(x, y, width, height, startAngle, arcAngle);
768 }
769
770 /**
771 * Overrides <code>Graphics.drawPolyline</code>.
772 */
773 public void drawPolyline(int xPoints[], int yPoints[], int nPoints) {
774 DebugGraphicsInfo info = info();
775
776 if (debugLog()) {
777 info().log(toShortString() +
778 " Drawing polyline: " +
779 " nPoints: " + nPoints +
780 " X's: " + xPoints +
781 " Y's: " + yPoints);
782 }
783 if (isDrawingBuffer()) {
784 if (debugBuffered()) {
785 Graphics debugGraphics = debugGraphics();
786
787 debugGraphics.drawPolyline(xPoints, yPoints, nPoints);
788 debugGraphics.dispose();
789 }
790 } else if (debugFlash()) {
791 Color oldColor = getColor();
792 int i, count = (info.flashCount * 2) - 1;
793
794 for (i = 0; i < count; i++) {
795 graphics.setColor((i % 2) == 0 ? info.flashColor : oldColor);
796 graphics.drawPolyline(xPoints, yPoints, nPoints);
797 Toolkit.getDefaultToolkit().sync();
798 sleep(info.flashTime);
799 }
800 graphics.setColor(oldColor);
801 }
802 graphics.drawPolyline(xPoints, yPoints, nPoints);
803 }
804
805 /**
806 * Overrides <code>Graphics.drawPolygon</code>.
807 */
808 public void drawPolygon(int xPoints[], int yPoints[], int nPoints) {
809 DebugGraphicsInfo info = info();
810
811 if (debugLog()) {
812 info().log(toShortString() +
813 " Drawing polygon: " +
814 " nPoints: " + nPoints +
815 " X's: " + xPoints +
816 " Y's: " + yPoints);
817 }
818 if (isDrawingBuffer()) {
819 if (debugBuffered()) {
820 Graphics debugGraphics = debugGraphics();
821
822 debugGraphics.drawPolygon(xPoints, yPoints, nPoints);
823 debugGraphics.dispose();
824 }
825 } else if (debugFlash()) {
826 Color oldColor = getColor();
827 int i, count = (info.flashCount * 2) - 1;
828
829 for (i = 0; i < count; i++) {
830 graphics.setColor((i % 2) == 0 ? info.flashColor : oldColor);
831 graphics.drawPolygon(xPoints, yPoints, nPoints);
832 Toolkit.getDefaultToolkit().sync();
833 sleep(info.flashTime);
834 }
835 graphics.setColor(oldColor);
836 }
837 graphics.drawPolygon(xPoints, yPoints, nPoints);
838 }
839
840 /**
841 * Overrides <code>Graphics.fillPolygon</code>.
842 */
843 public void fillPolygon(int xPoints[], int yPoints[], int nPoints) {
844 DebugGraphicsInfo info = info();
845
846 if (debugLog()) {
847 info().log(toShortString() +
848 " Filling polygon: " +
849 " nPoints: " + nPoints +
850 " X's: " + xPoints +
851 " Y's: " + yPoints);
852 }
853 if (isDrawingBuffer()) {
854 if (debugBuffered()) {
855 Graphics debugGraphics = debugGraphics();
856
857 debugGraphics.fillPolygon(xPoints, yPoints, nPoints);
858 debugGraphics.dispose();
859 }
860 } else if (debugFlash()) {
861 Color oldColor = getColor();
862 int i, count = (info.flashCount * 2) - 1;
863
928 }
929 } else if (debugFlash()) {
930 Color oldColor = getColor();
931 int i, count = (info.flashCount * 2) - 1;
932
933 for (i = 0; i < count; i++) {
934 graphics.setColor((i % 2) == 0 ? info.flashColor
935 : oldColor);
936 graphics.drawString(iterator, x, y);
937 Toolkit.getDefaultToolkit().sync();
938 sleep(info.flashTime);
939 }
940 graphics.setColor(oldColor);
941 }
942 graphics.drawString(iterator, x, y);
943 }
944
945 /**
946 * Overrides <code>Graphics.drawBytes</code>.
947 */
948 public void drawBytes(byte data[], int offset, int length, int x, int y) {
949 DebugGraphicsInfo info = info();
950
951 Font font = graphics.getFont();
952
953 if (debugLog()) {
954 info().log(toShortString() +
955 " Drawing bytes at: " + new Point(x, y));
956 }
957
958 if (isDrawingBuffer()) {
959 if (debugBuffered()) {
960 Graphics debugGraphics = debugGraphics();
961
962 debugGraphics.drawBytes(data, offset, length, x, y);
963 debugGraphics.dispose();
964 }
965 } else if (debugFlash()) {
966 Color oldColor = getColor();
967 int i, count = (info.flashCount * 2) - 1;
968
969 for (i = 0; i < count; i++) {
970 graphics.setColor((i % 2) == 0 ? info.flashColor
971 : oldColor);
972 graphics.drawBytes(data, offset, length, x, y);
973 Toolkit.getDefaultToolkit().sync();
974 sleep(info.flashTime);
975 }
976 graphics.setColor(oldColor);
977 }
978 graphics.drawBytes(data, offset, length, x, y);
979 }
980
981 /**
982 * Overrides <code>Graphics.drawChars</code>.
983 */
984 public void drawChars(char data[], int offset, int length, int x, int y) {
985 DebugGraphicsInfo info = info();
986
987 Font font = graphics.getFont();
988
989 if (debugLog()) {
990 info().log(toShortString() +
991 " Drawing chars at " + new Point(x, y));
992 }
993
994 if (isDrawingBuffer()) {
995 if (debugBuffered()) {
996 Graphics debugGraphics = debugGraphics();
997
998 debugGraphics.drawChars(data, offset, length, x, y);
999 debugGraphics.dispose();
1000 }
1001 } else if (debugFlash()) {
1002 Color oldColor = getColor();
1003 int i, count = (info.flashCount * 2) - 1;
1004
|
1 /*
2 * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
753 debugGraphics.dispose();
754 }
755 } else if (debugFlash()) {
756 Color oldColor = getColor();
757 int i, count = (info.flashCount * 2) - 1;
758
759 for (i = 0; i < count; i++) {
760 graphics.setColor((i % 2) == 0 ? info.flashColor : oldColor);
761 graphics.fillArc(x, y, width, height, startAngle, arcAngle);
762 Toolkit.getDefaultToolkit().sync();
763 sleep(info.flashTime);
764 }
765 graphics.setColor(oldColor);
766 }
767 graphics.fillArc(x, y, width, height, startAngle, arcAngle);
768 }
769
770 /**
771 * Overrides <code>Graphics.drawPolyline</code>.
772 */
773 public void drawPolyline(int[] xPoints, int[] yPoints, int nPoints) {
774 DebugGraphicsInfo info = info();
775
776 if (debugLog()) {
777 info().log(toShortString() +
778 " Drawing polyline: " +
779 " nPoints: " + nPoints +
780 " X's: " + xPoints +
781 " Y's: " + yPoints);
782 }
783 if (isDrawingBuffer()) {
784 if (debugBuffered()) {
785 Graphics debugGraphics = debugGraphics();
786
787 debugGraphics.drawPolyline(xPoints, yPoints, nPoints);
788 debugGraphics.dispose();
789 }
790 } else if (debugFlash()) {
791 Color oldColor = getColor();
792 int i, count = (info.flashCount * 2) - 1;
793
794 for (i = 0; i < count; i++) {
795 graphics.setColor((i % 2) == 0 ? info.flashColor : oldColor);
796 graphics.drawPolyline(xPoints, yPoints, nPoints);
797 Toolkit.getDefaultToolkit().sync();
798 sleep(info.flashTime);
799 }
800 graphics.setColor(oldColor);
801 }
802 graphics.drawPolyline(xPoints, yPoints, nPoints);
803 }
804
805 /**
806 * Overrides <code>Graphics.drawPolygon</code>.
807 */
808 public void drawPolygon(int[] xPoints, int[] yPoints, int nPoints) {
809 DebugGraphicsInfo info = info();
810
811 if (debugLog()) {
812 info().log(toShortString() +
813 " Drawing polygon: " +
814 " nPoints: " + nPoints +
815 " X's: " + xPoints +
816 " Y's: " + yPoints);
817 }
818 if (isDrawingBuffer()) {
819 if (debugBuffered()) {
820 Graphics debugGraphics = debugGraphics();
821
822 debugGraphics.drawPolygon(xPoints, yPoints, nPoints);
823 debugGraphics.dispose();
824 }
825 } else if (debugFlash()) {
826 Color oldColor = getColor();
827 int i, count = (info.flashCount * 2) - 1;
828
829 for (i = 0; i < count; i++) {
830 graphics.setColor((i % 2) == 0 ? info.flashColor : oldColor);
831 graphics.drawPolygon(xPoints, yPoints, nPoints);
832 Toolkit.getDefaultToolkit().sync();
833 sleep(info.flashTime);
834 }
835 graphics.setColor(oldColor);
836 }
837 graphics.drawPolygon(xPoints, yPoints, nPoints);
838 }
839
840 /**
841 * Overrides <code>Graphics.fillPolygon</code>.
842 */
843 public void fillPolygon(int[] xPoints, int[] yPoints, int nPoints) {
844 DebugGraphicsInfo info = info();
845
846 if (debugLog()) {
847 info().log(toShortString() +
848 " Filling polygon: " +
849 " nPoints: " + nPoints +
850 " X's: " + xPoints +
851 " Y's: " + yPoints);
852 }
853 if (isDrawingBuffer()) {
854 if (debugBuffered()) {
855 Graphics debugGraphics = debugGraphics();
856
857 debugGraphics.fillPolygon(xPoints, yPoints, nPoints);
858 debugGraphics.dispose();
859 }
860 } else if (debugFlash()) {
861 Color oldColor = getColor();
862 int i, count = (info.flashCount * 2) - 1;
863
928 }
929 } else if (debugFlash()) {
930 Color oldColor = getColor();
931 int i, count = (info.flashCount * 2) - 1;
932
933 for (i = 0; i < count; i++) {
934 graphics.setColor((i % 2) == 0 ? info.flashColor
935 : oldColor);
936 graphics.drawString(iterator, x, y);
937 Toolkit.getDefaultToolkit().sync();
938 sleep(info.flashTime);
939 }
940 graphics.setColor(oldColor);
941 }
942 graphics.drawString(iterator, x, y);
943 }
944
945 /**
946 * Overrides <code>Graphics.drawBytes</code>.
947 */
948 public void drawBytes(byte[] data, int offset, int length, int x, int y) {
949 DebugGraphicsInfo info = info();
950
951 Font font = graphics.getFont();
952
953 if (debugLog()) {
954 info().log(toShortString() +
955 " Drawing bytes at: " + new Point(x, y));
956 }
957
958 if (isDrawingBuffer()) {
959 if (debugBuffered()) {
960 Graphics debugGraphics = debugGraphics();
961
962 debugGraphics.drawBytes(data, offset, length, x, y);
963 debugGraphics.dispose();
964 }
965 } else if (debugFlash()) {
966 Color oldColor = getColor();
967 int i, count = (info.flashCount * 2) - 1;
968
969 for (i = 0; i < count; i++) {
970 graphics.setColor((i % 2) == 0 ? info.flashColor
971 : oldColor);
972 graphics.drawBytes(data, offset, length, x, y);
973 Toolkit.getDefaultToolkit().sync();
974 sleep(info.flashTime);
975 }
976 graphics.setColor(oldColor);
977 }
978 graphics.drawBytes(data, offset, length, x, y);
979 }
980
981 /**
982 * Overrides <code>Graphics.drawChars</code>.
983 */
984 public void drawChars(char[] data, int offset, int length, int x, int y) {
985 DebugGraphicsInfo info = info();
986
987 Font font = graphics.getFont();
988
989 if (debugLog()) {
990 info().log(toShortString() +
991 " Drawing chars at " + new Point(x, y));
992 }
993
994 if (isDrawingBuffer()) {
995 if (debugBuffered()) {
996 Graphics debugGraphics = debugGraphics();
997
998 debugGraphics.drawChars(data, offset, length, x, y);
999 debugGraphics.dispose();
1000 }
1001 } else if (debugFlash()) {
1002 Color oldColor = getColor();
1003 int i, count = (info.flashCount * 2) - 1;
1004
|