go to previous page   go to home page   go to next page

Answer:

Graphics


Graphics (Review)

Grid

A JPanel is a container object that can be drawn on and can contain other AWT components. Its paintComponent(Graphics g) method is called when it needs to be drawn. The Graphics object contains methods to draw on that part of the screen. Think of the panel as a rectangle of graph paper. Each small square is a pixel.

A JPanel is a rectangle width pixels across and height pixels in height. A location in the rectangle is described as (X, Y) where X and Y are integers. The (0, 0) location is at the top left.

Columns are numbered 0 to width-1 starting at the left. Rows are numbered 0 to height-1 starting at the top.


QUESTION 2:

(Review: )What is the name of the method (of class Graphics) that draws a line from (x0, y0) to (x1, y1) ?

( int x0, int y0, int x1, int y1)