Lasha Janjgava
Lasha Janjgava

Reputation: 23

Setting background color using java.awt.color

This is my first Swing project on Eclipse, and I cannot set the background color of a component. I have tried by using this code :

B_Send.setBackground(new java.awt.color(0,0,255));

which returns the error:

java.awt.color cannot be resolved to a type

Can anyone explain the error and why the code isn't working?

Upvotes: 1

Views: 1248

Answers (1)

Hovercraft Full Of Eels
Hovercraft Full Of Eels

Reputation: 285405

It's not java.awt.color but rather java.awt.Color.

Yes, these little things mean a lot, and the Java compiler is extremely persnickety. Welcome to the world of programming.

Upvotes: 6

Related Questions