Skip to content

Commit 9985a87

Browse files
author
Sean Thames
committed
added the bay area to the graphic.
1 parent e40490f commit 9985a87

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

m9/ex11/JFavoriteState.java

+10
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ drawing it on graph paper (I tried both).
2828
public static final float xPoints[] = {7, 147, 147, 325, 325, 333, 341, 332, 328, 330, 329, 325, 322, 324, 323, 325, 329, 331, 327, 242, 243, 240, 238, 238, 235, 229, 223, 215, 210, 205, 203, 200, 201, 196, 189, 186, 184, 177, 172, 171, 165, 160, 156, 151, 143, 136, 131, 129, 125, 127, 125, 127, 125, 126, 123, 117, 118, 116, 113, 108, 104, 102, 93, 84, 82, 86, 87, 83, 75, 67, 66, 63, 64, 63, 58, 55, 50, 47, 48, 48, 45, 42, 22, 24, 20, 20, 21, 19, 19, 11, 11, 2, 2, 0, 8, 10, 8, 11, 11, 9, 8, 5, 7};
2929
public static final float yPoints[] = {1, 1, 120, 280, 286, 301, 309, 317, 324, 332, 338, 344, 345, 351, 356, 359, 360, 365, 371, 379, 375, 372, 373, 362, 354, 347, 341, 336, 331, 330, 332, 330, 328, 319, 319, 321, 319, 317, 314, 310, 306, 303, 304, 304, 302, 302, 303, 299, 298, 292, 289, 287, 284, 277, 273, 271, 266, 262, 262, 255, 253, 249, 236, 229, 216, 215, 206, 202, 202, 192, 182, 179, 173, 167, 164, 164, 159, 161, 157, 150, 148, 142, 123, 120, 109, 102, 94, 92, 87, 79, 77, 70, 66, 63, 47, 42, 36, 28, 19, 14, 11, 9, 6};
3030

31+
// My stepdad informed me it was not good enough without the bay area lol
32+
public static final float bayX[] = {64, 67, 67, 71, 77, 75, 74, 69, 70, 66, 68, 71, 77, 82, 81, 80, 78, 75, 71, 70, 68, 64};
33+
public static final float bayY[] = {168, 170, 175, 178, 182, 178, 174, 168, 165, 163, 160, 158, 159, 159, 157, 153, 155, 158, 158, 154, 154, 156};
3134
Font label = new Font("Courier New", Font.BOLD, 12);
3235

3336
public JFavoriteState()
@@ -42,13 +45,20 @@ public void paint(Graphics gr)
4245
super.paint(gr);
4346
Graphics2D gr2D = (Graphics2D)gr;
4447
GeneralPath cal = new GeneralPath();
48+
GeneralPath bay = new GeneralPath();
4549

4650
cal.moveTo(xPoints[0] + 10, yPoints[0] + 50);
4751
for(int i = 1; i < xPoints.length; i++)
4852
cal.lineTo(xPoints[i] + 10, yPoints[i] + 50);
4953
cal.closePath();
5054

55+
bay.moveTo(bayX[0] + 10, bayY[0] + 50);
56+
for(int i = 1; i < bayX.length; i++)
57+
bay.lineTo(bayX[i] + 10, bayY[i] + 50);
58+
bay.closePath();
59+
5160
gr2D.draw(cal);
61+
gr2D.draw(bay);
5262

5363
gr.setFont(label);
5464
gr.drawString("California", 125, 225);

0 commit comments

Comments
 (0)