Difference between canvas class & graphics class?

Answer Posted / mallareddy.pindi

The Canvas class is a base class for writing applications
that need to handle low-level events and to issue graphics
calls for drawing to the display. Game applications will
likely make heavy use of the Canvas class. From an
application development perspective, the Canvas class is
interchangeable with standard Screen classes, so an
application may mix and match Canvas with high-level screens
as needed. For example, a List screen may be used to select
the track for a racing game, and a Canvas subclass would
implement the actual game.
The Graphics class provides the framework for all graphics
operations within the AWT. It plays two different, but
related, roles. First, it is the graphics context. The
graphics context is information that will affect drawing
operations. This includes the background and foreground
colors, the font, and the location and dimensions of the
clipping rectangle

Is This Answer Correct ?    13 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

5 Coding best practices you learned in java?

817


How will you communicate between two applets?

850


Define array. Tell me about 2-D array.

806


What are triggers in DB? Explain their types. How do they work?

855


How does linkedlist work in java?

694


Is set ordered in java?

768


What is lambda programming?

699


What is the use of static class?

771


What is outofmemoryerror in java?

755


What is the difference between iterator and list iterator?

735


What is the use of http-tunneling in rmi?

783


What languages are pass by reference?

770


What is the disadvantage of synchronization?

754


when you will synchronize a piece of your code? : Java thread

748


How do you read a char in java?

696