13.2 Graphics Contexts and Graphics Objects
A graphics context enables drawing on the screen. A Graphics
object manages a graphics context and draws pixels on the screen that represent text and other graphical objects (e.g., lines, ellipses, rectangles and other polygons). Graphics
objects contain methods for drawing, font manipulation, color manipulation and the like.
Class Graphics
is an abstract
class (i.e., you cannot instantiate Graphics
objects). This contributes to Java’s portability. Because drawing is performed differently on every platform that supports Java, there cannot be only one implementation of the drawing capabilities across all systems. When Java is implemented on a particular platform, a subclass of Graphics
is created that ...
Get Java™ How To Program (Early Objects), Tenth Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.