标签: arraylist colors jframe jpanel jbutton
我在jframe中有一个Jbuttons的arraylist,当我选择某个jbutton时,我需要改变特定jbutton的背景颜色。关于如何解决这个问题的任何提示?我尝试使用设置背景颜色,但由于它是按钮的ArrayList,它不会运行。
答案 0 :(得分:0)
您可以使用map或forEach将函数映射到检查ID的每个按钮上,如果匹配,则在该按钮上设置颜色代码。