MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

COMPUTER GRAPHICS

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
With what arguments(s) is the setColor method of the Graphics class called?
A
a Color object
B
three integers (red, green, blue components of a color)
C
a BasicStroke object
D
a Paint object
Explanation: 

Detailed explanation-1: -setcolor sets the current drawing color to color, which can range from 0 to getmaxcolor. The current drawing color is the value to which pixels are set when lines, and so on are drawn. The drawing colors shown below are available for the CGA and EGA, respectively.

Detailed explanation-2: -Because the Graphics class is an abstract base class, it cannot be instantiated directly. An instance is typically created by a component, and handed to the program as an argument to a component’s update() and paint() methods. These two methods, along with the repaint() method, are discussed in the next section.

Detailed explanation-3: -The paint( ) Method The paint() method is called by Java when it’s time for our applet to draw itself on the screen. It takes a single argument, a Graphics object, and doesn’t return any type of value (void) to its caller.

There is 1 question to complete.