CS 162 Lecture-Module #02:
Overview of Java Programming with Graphics


"The Analytical Engine has no pretensions whatever to originate anything. [But] it can do whatever we know how to order it to perform."
: Ada Lovelace, the world's first computer programmer


programs operate in the context of a system

hence need framework

import java.awt...          ----+
                                |
public class Picture {          |
 .                              | ~~ignore this as much as possible
  .                             |    --- just copy as needed
   .                            |
                                |
    public void                 |
                draw() {        | <some main 'method'>
                            ----+
                            ----+
        .                       | <-- here is where you work
        .                       |     -==-
        .                       |     writing your program
                             ---+       --- list of instructions
         }
programming environment --- ~~significant part of framework
* type your program:  prog.java ,  prog.html
    * basic editor such as  NotePad
    or
    * IDE             such as BlueJ
* compile and execute i.e. run your program
    * MSDOS / Command prompt
    *  javac prog.java
    *  appletviewer prog.html
    or
    * within IDE use menus etc. to request everything
* improve/debug your program:
    * consider compilation-errors particularly the first one
        e.g. if forget ";" at end of first  import-line
        *  javac prog.java 2>&1  more
        or things your program does differently from what you want
    * re-edit your  .java file
    * re-try compiling and executing
(* save and print your material)



<Picture>

Java coordinate-system:
        (0,0)    15                 horizontal
            +----+----------------------->
            |
            |
            |
            |
         25 +    
            |
            |
            |
         40 +    
            |
            |
vertical    V

positive
increasing
downward
(
NOT Cartesian coordinate-system where vertical coordinates increase upward:
    y ↑
      |
      |
      +--->
          x
)
a way to remember that vertical coordinates increase downward here is:
consider that when type on computer, increasing lines ==> 

unit of measurement is 

line of text ~~12 pixels depth -- but skip 15 from one line to next for inter-line space
order of statements appears not to matter much here
but we'll be seeing that things drawn later are drawn on top


(Copyright © 2009 by Hugh McGuire   — for thoughts about this, see   http://www.cis.gvsu.edu/~mcguire/teaching/copyright_thoughts.html .)