Slides0302 - have learned about, the origin is in the top...

Info iconThis preview shows pages 1–8. Sign up to view the full content.

View Full Document Right Arrow Icon
Slides 3/2 COP 3330
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Topics GUI
Background image of page 2
Example Program Finish the GUI program that converts Fahrenheit to Celsius - o C = (5/9)( o F - 32)
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
GUI - Canvas Objects of type Canvas represent a drawing area on which your program can draw Canvas is in java.awt You may wish to have your own class extend Canvas so that you can override its paint method
Background image of page 4
GUI - Canvas In order to paint on the Canvas, you need to have access to its Graphics object, which can be accessed by the getGraphics method on Canvas. There are many drawing methods on Graphics objects - drawLine - drawRectangle - drawOval - And more!
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
GUI - Canvas Unlike other coordinate systems you may
Background image of page 6
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 8
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: have learned about, the origin is in the top left corner The positive x direction is to the right The positive y direction is down GUI - Canvas Before you call a draw method, you should set the color in which you're going to be drawing using the setColor method on the Graphics object. setColor takes in a Color (from java.awt) Some common colors are built into the Color class You can also define your own color by specifying the intensity of its red, green, and blue components GUI - Canvas Example: Write a program that displays a fountain of dots...
View Full Document

This note was uploaded on 02/09/2010 for the course CS COP 3330 taught by Professor Douglass during the Spring '09 term at University of Central Florida.

Page1 / 8

Slides0302 - have learned about, the origin is in the top...

This preview shows document pages 1 - 8. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online