Computer Science, asked by shirishabaddal, 9 months ago

difference between setforeground() and setcolor() methods. ​

Answers

Answered by iftekharahmad157
11

Explanation:

set colour is used to change current drawing color

Set foreground is used to select foreground color

Answered by mariospartan
7

setforeground() sets the color of the text

setcolor() sets the color of the drawing

setbackground() sets the color of the background

Explanation:

"setcolor()" will set the pen color of the drawing which is going to be drawn

Example:

setColor(Color.BLUE);

drawOval(20,20,100,100);

fillOval(20, 20, 100, 100);

Now the color will be set as blue and then oval shape will be drawn with blue color.

once again fill oval will fill the oval with blue.

setforeground():

Rather setforeground() corresponds to color of the text and to be clear it is no way related to the background color.

Example:

setForeground(Color.red);

drawString("Hello", 100, 80);

The text  "Hello" will appear in red.

To Know More:

https://brainly.in/question/11132631

Which among the following Java built in class methods are not synchronized​

https://brainly.in/question/9040484

How to write string functions in Java?

Similar questions