Welcome to the CSC Q&A, on our server named in honor of Ada Lovelace. Write great code! Get help and give help!
It is our choices... that show what we truly are, far more than our abilities.


+17 votes
asked in CSC211_Winter2018 by (1 point)

the example we saw in class is not working.


Perhaps it's not working because you didn't copy all of the image and sound files into the Eclipse project folder? (Not the "src" folder, but just the overall project folder)?

1 Answer

+12 votes

To set a background color of a drawing panel, use the following call:

Read the next line without the < >

.setBackground(Color.); The panel name should be whatever you decided to call your panel in your program and the color is up to you to change. If you would like to display an image as a background, then I would display the image first as anything else you draw will be on that of that image. Perhaps there is another way, but this is what I can think of right now.
answered by (1 point)