Basic Classes in AWT
Graphics class
Graphics class is an abstract class that provides methods for drawing and manipulating fonts and colors. This class performs drawings differently on different platforms.
Eg:-drawing a shape in a MS Windows OS, will have different capabilities when compared with doing the same thing in a UNIX system.
The drawing capabilities in each platform were achieved by implementing Platform dependent sub classes of the Graphics class. Therefore all these platform dependent classes are hidden by this Graphics class, which helps the programmer to write platform-independent code.
color class and font class.
color class
The color class is used to manipulate colors using the methods and constants defined in it. Every color is a combination of red, green, blue. Combination of these three colors, which take values from 0 to 255 or 0.0 to 0.1 can generate any new color. Therefore, the color class has two constructors, one takes integer parameters and another takes float parameters.
The Graphics class has the methods set and get which can be used to set the color of the object that is being drawn and to get the color of the drawing object, respectively.
Comments
Post a Comment