csc2700lect10

csc2700lect10 - CSc 2700: Lecture # 10-11 Programming...

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

View Full Document Right Arrow Icon

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

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

Unformatted text preview: CSc 2700: Lecture # 10-11 Programming Graphics Basics September 30, & October 2, 2008 To be able to write simple graphical applications To display graphical shapes, such as lines and ellipses To Use Colors To display drawings consists of many shapes and text 1 Screen vs Cartesian Coordinates The Cartesian plane is basically a flat plane with its dimensions described in x and y coordinates. The x coordinate describes the position of an object horizontal to the plane while the y describes the position of an object vertical to the plane. The Cartesian plane and a computer monitor differ in two ways. 1. The Cartesian planes center is called the origin and has the coordinate values (0,0). Any x coordinate to the right of the origin is represented as a positive number and to the left as a negative. On a computer the origin is the upper left pixel of the screen, so there is nothing above or to the left of the origin on the monitor. 2. On the Cartesian plane, any y coordinate above the origin is positive and any coordinate below the origin is negative. On a computer any- thing below the origin is positive, and anything above it is negative. Therefore on a computer the y coordinate increases from the top of the monitor to the bottom. 1 2 Viewing A Frame Here are some of the basic commands we will use in creating and rendering the basic shapes we will create in this course. 2.1 Creating An Empty Frame JFrame() Constructs a new frame that is initially invisible. jframeObject.setSize(int width, int height) Resizes this component so that it has width width and height. jframeObject.setTitle(String title) Sets the title for this frame to the specified string. jframeObject.setDefaultCloseOperation(int operation) Sets the operation that will happen by default when the user initiates a "close" on this frame. You must specify one of the following choices: DO NOTHING ON CLOSE (defined in WindowConstants): Dont do anything; require the program to handle the operation in the window- Closing method of a registered WindowListener object. HIDE ON CLOSE (defined in WindowConstants): Automatically hide the frame after invoking any registered WindowListener objects. DISPOSE ON CLOSE (defined in WindowConstants): Automatically hide and dispose the frame after invoking any registered WindowLis- tener objects....
View Full Document

This note was uploaded on 10/06/2009 for the course CSC 2700 taught by Professor Duncan during the Spring '08 term at LSU.

Page1 / 12

csc2700lect10 - CSc 2700: Lecture # 10-11 Programming...

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

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