{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

csc2700lect10

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

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

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

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

View Full Document
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): Don’t 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.
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 12

csc2700lect10 - CSc 2700 Lecture 10-11 Programming Graphics...

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

View Full Document
Ask a homework question - tutors are online