DOC PREVIEW
LETU COSC 2103 - Graphics and Java2D

This preview shows page 1-2-24-25 out of 25 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 25 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 25 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 25 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 25 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 25 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Graphics and Java2DJava Coordinate SystemGraphics Contexts & ObjectsThe Graphics Class The paint() MethodThe paint MethodColor ControlColor MethodsSlide 8Graphics ApplicationsFont Control MethodsFont ControlFont Metrics MethodsFont MetricsGraphics Methods for Lines, Rectangles, OvalsSlide 15Drawing Lines, Rectangles, OvalsSlide 17Graphics Methods for Drawing ArcsDrawing ArcsGraphics Methods for Drawing PolygonsSlide 21Polygons and PolylinesJava2D APISlide 24Slide 25Graphics and Java2DChapter 122Java Coordinate System•Origin is in _____________ corner–Behind title bar of window•X values increase to the ________•________ increasedown the screen•Coordinate units are in __________3Graphics Contexts & Objects•A Java graphics enables drawing on the screen•A Graphics object–Manages a graphics context–Draws pixels that represent ___________–Draws pixels that represent ___________•Graphics objects have methods for –Drawing –Font and ___________ manipulation4The Graphics ClassThe paint() Method•Graphics is an _____________ class–Cannot be instantiated•Class Component has method ________–Takes a ___________ object as an argument public void paint (Graphics g)•Component also has–public void ___________()–public void update (Graphics g)•We focus on the paint method in this chapter5The paint Method•A Swing GUI needs to paint itself –The ___________ time–In response to becoming _____________–Because it needs to reflect a change in the program's state •Starts with the highest component that needs to be repainted –Works its way down the containment __________________.•Sun tutorial on the paint method6Color Control•Class Color has – – –Used to manipulate ______________•Colors created from mix of red, green, blue components–Specified in range from 0 to 255 (or floating point values 0.0 to 1.0)•Methods include–Constructors, get (for R, G, B, and color), set7Color Methods8Color Control•Note Figure 12.5–Draws color __________–Draws ___________ in color–Gets color values for use•Note Figure 12.6–Demonstrates the JColorChooser GUI component–Note the ___________ of the component for specifying the color in different ways9Graphics Applications•As always the program "is a _________"•This time–The class (program) extends _____________–We have a constructor for the class–That ___________ does most of the activity•The ___________ function does very little–Creates an instance of the class that is the program•This instantiation calls the constructor–Sets up the exit call10Font Control Methods11Font Control•Font class constructor arguments– – – •View demonstration of font control–Figure 12.9•Note, to change the font–Must create a ________________________–Font objects are ______________ – no set methods12Font Metrics Methods13Font Metrics•Sometimes necessary to get info about current drawing font–Name, style, font size–Class _________________ has methods for accessing•Note further measurements (metrics) concerning fonts•View Figure 12.12, program to manipulate font metrics14Graphics Methods for Lines, Rectangles, Ovals15Graphics Methods for Lines, Rectangles, Ovals16Drawing Lines, Rectangles, Ovals•Methods to manage:–Lines–Rectangles (_____________ or ____________)–Round cornered rectangles–3D renditions of rectangles–Ovals•Note height andwidth specs forovals17Drawing Lines, Rectangles, Ovals•View sample program, Figure 12.14–Note use of ________________________() from Graphics class18Graphics Methods for Drawing Arcs19Drawing Arcs•Definition of an arc–A portion of an ________–Measured in _________•Arguments for arc methods–Coordinates for upper _____ corner–Height, width–________ for start of sweep–Number of degrees for ________•View Figure 12.19, drawing arcs20Graphics Methods for Drawing Polygons21Graphics Methods for Drawing Polygons22Polygons and Polylines•Polygon–Multisided shape–Composed of _________________•Polyline–Sequence of ______________ points•Note Polygon class, pg 592–Constructors•View Figure 12.21, a program to draw polygons and polylines23Java2D API•Advanced two-dimensional graphics •Drawing accomplished with instance of Graphics2D–An abstract _____________ of Graphics–Must cast ____________________ passed to paint into a Graphics2D referenceGraphics2D g2d = (Graphics2D) g;24Java2D API•Note capabilities–New __________added to shapesdrawn–____________–Fill with graphic–_____________ lines•View Figure 12.22 which created this output25Java2D API•General path : a shape constructed from–___________ lines and–Complex ____________•View Figure 12.23–Uses GeneralPath


View Full Document

LETU COSC 2103 - Graphics and Java2D

Documents in this Course
Arrays

Arrays

16 pages

Templates

Templates

17 pages

Methods

Methods

22 pages

Methods

Methods

22 pages

Arrays

Arrays

11 pages

Load more
Download Graphics and Java2D
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Graphics and Java2D and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Graphics and Java2D 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?