CSE 142 Lecture 6: Drawing in Java - Basics
CSE 142 verified notes
6/30View all
Document Summary
Close the file and no(cid:437) you can run your code. 6 public static drawingpanel panel = new drawingpanel(400, 200); Dra(cid:363)ing in ja(cid:362)a - adding coordinates (cid:368) and (cid:369) Code: (cid:352)see orange notes for details and clarification(cid:353) 15 public static void drawvan(graphics brush, int x, int y) { 17 // (coordinates x and y in the method must be applied below!) 18 // the size is 100 right now. 19 // if you wanted to, you could use one call constant and. // function of size: (50 = size / 2). // change it all at once but then each van would be the same. 25 brush. fillrect(x + 70, y +10, 20, 20); 26 // above is also known as brush. fillrect(x + (size * 7 / // y + size / 10, size * 3 / 10, size / 5); 29 // coordinate 80 is created by adding x + 70! fill in x and y.