by mr hanley 10/31/2014. stddraw is a class developed by princeton university to help novice java...

5
USING STDDRAW TO RENDER GRAPHICS By mr Hanley 10/31/2014

Upload: marian-howard

Post on 23-Dec-2015

214 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: By mr Hanley 10/31/2014.  StdDraw is a class developed by Princeton University to help novice java programmers interact with a JFrame’s  A computer

USING STDDRAW TO RENDER GRAPHICS

By mr Hanley 10/31/2014

Page 2: By mr Hanley 10/31/2014.  StdDraw is a class developed by Princeton University to help novice java programmers interact with a JFrame’s  A computer

COMPUTER GRAPHICS

StdDraw is a class developed by Princeton University to help novice java programmers interact with a JFrame’s

A computer window uses x and y coordinates to determine where graphics are “painted”

Individual graphics can be drawn using StdDraw. followed by one of the lines or shapes

Page 3: By mr Hanley 10/31/2014.  StdDraw is a class developed by Princeton University to help novice java programmers interact with a JFrame’s  A computer

THE BOUNDARIES AND SCALE

You need to set the bounds and scale of your window

X=0, Y=0

X=width-1, Y=height-1

Page 4: By mr Hanley 10/31/2014.  StdDraw is a class developed by Princeton University to help novice java programmers interact with a JFrame’s  A computer

DRAWING ELEMENTS AND PEN COLOR To change pen color use

StdDraw.setPencolor(Color.black); or Color. And see which options pop up

StdDraw.clear(Color.choose a color) will clear the background to a certain color

StdDraw.show(milliseconds) will show the current scene for 20 milliseconds

Page 5: By mr Hanley 10/31/2014.  StdDraw is a class developed by Princeton University to help novice java programmers interact with a JFrame’s  A computer

GETTING IT SET UP

Search for StdDraw.java from web Copy source to a StdDraw class in your

project Make your program in a separate class You don’t need to make changes to

StdDraw.java file