DOC PREVIEW
TRINITY CSCI 1320 - Graphics

This preview shows page 1-2-3 out of 10 pages.

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

Unformatted text preview:

Graphics 10 31 2011 Opening Discussion Minute essay comments Getting clock information Are we going to have lots of imports Limiting options in a text game How do you know when to do an import Can you make non geometric drawings More General Drawing Graphics2D objects aren t limited to just drawing on components The Image class and it s subtype BufferedImage will let you get Graphics objects that you can draw to and what you draw will be on the image We ll typically do this even if we are drawing to a component to implement buffering which reduces flicker Loading Images The easiest way to load images from disk is using javax imageio ImageIO This class has read methods that take File or URL objects Double Buffering The proper way to write the paint method is to have a BufferedImage that you draw to then draw the image to the provided Graphics2D object This is called double buffering and it prevents flicker and can make things run faster Mouse Events There are several types of events that relate to the mouse MouseClicked MouseDragged MousePressed Listen to one of the publishers on a component mouse clicks mouse moves mouse wheel Key Events There are three event types for keys KeyPressed KeyReleased KeyTyped Listen to the keys object in a component to get these Compare the key value in the event to values in the Key object if e key Key A if e key Key Left Animations For animations and many other things we want code to happen at regular intervals We can set this up with a javax swing Timer new Timer delay Int ae ActionListener Delay is in milliseconds Swing ActionListener handler ActionEvent Unit The function body will be executed at the desired intervals Writing Transforms Last time we mentioned AffineTransforms but didn t see what they can do Let s take some time now to write code that uses an AffineTransform in our drawing Minute Essay Questions about graphics There is an IcP next class


View Full Document

TRINITY CSCI 1320 - Graphics

Documents in this Course
Functions

Functions

10 pages

Functions

Functions

10 pages

Graphics

Graphics

11 pages

Loops

Loops

4 pages

Loops

Loops

3 pages

Strings

Strings

9 pages

Functions

Functions

10 pages

Loops

Loops

11 pages

Graphics

Graphics

11 pages

Graphics

Graphics

12 pages

Sorting

Sorting

11 pages

Sorting

Sorting

10 pages

Arrays

Arrays

10 pages

Loops

Loops

18 pages

Load more
Download Graphics
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 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 access 3M+ class-specific study document.

or

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

Already a member?