简体   繁体   English

如何使用颜色代码为回转组件添加背景色?

[英]how to add back ground color for swing components using color codes?

I want to add back ground color for my JPanel in java . 我想在Java中为我的JPanel添加背景色。 Instead of using Color.RED in the setBackground function , I want to use color code like #FFF380 in the function. 我不想在setBackground函数中使用Color.RED,而是要在函数中使用#FFF380之类的颜色代码。 Is it possible to use these color codes in the function. 是否可以在功能中使用这些颜色代码。

这非常简单:

xy.setBackground(Color.decode("#6365ff"));

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM