Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
这是我在 Eclipse 上的第一个 Swing 项目,我无法设置组件的背景颜色。我已经尝试使用此代码:
B_Send.setBackground(new java.awt.color(0,0,255));
返回错误:
java.awt.color 无法解析为类型
谁能解释错误以及为什么代码不起作用?
不是java.awt.color,而是java.awt.Color。
java.awt.color
java.awt.Color
是的,这些小事意义重大,而且 Java 编译器非常挑剔。欢迎来到编程的世界。