How to Use Graphics in a Java Applet
Invoke the drawRect method of the Graphics class.
1 Steps
1 min read
Easy
Step-by-Step Guide
-
Step 1: Invoke the drawRect method of the Graphics class.
The arguments to the method should be, in order, the top left corner's x coordinate, the top left corner's y coordinate, the width, and the height.
Here is a sample code snippet:
So, the rectangle's top left corner's coordinates will be (10,15), and its width will be 50 pixels, and its height will be 30 pixels.
Detailed Guide
The arguments to the method should be, in order, the top left corner's x coordinate, the top left corner's y coordinate, the width, and the height.
Here is a sample code snippet:
So, the rectangle's top left corner's coordinates will be (10,15), and its width will be 50 pixels, and its height will be 30 pixels.
About the Author
D
Donald Rodriguez
Brings years of experience writing about practical skills and related subjects.
57 articles
View all articles
Rate This Guide
--
Loading...
5
0
4
0
3
0
2
0
1
0
How helpful was this guide? Click to rate: