![]() The Graphics class contains many of the drawing functions to draw basic shapes like circles, lines, and squares (rectangles).įinally, there is the JFrame class that allows the programmer to create a window where the drawings will be rendered. The Graphics class can be added to any program using the import statement, ‘import java.awt.*”. Next, there is the Graphics class that we will need to help draw our shapes. This function is where we will do all of our drawings prior to passing the shapes to the JFrame function. As stated above, this will allow us to have access to the “paint” function (in which we will override). ![]() Plus, I wanted to touch on the Canvas extension I will be using to have access to the “paint” function.įirst, we will tell our program to extend the Canvas class. A Little Info about the Graphics, Canvas, and JFrame Classes.īefore I show you the initial code, I wanted to explain the two main classes we will be using to create our shapes.
0 Comments
Leave a Reply. |