且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Java着色表行

更新时间:2023-12-03 11:30:40

JTable的默认呈现器是跨多个单元共享的整个表的单个实例.设置好前景后,便会对其进行所有使用.如果该值不为null,则应将其设置回默认颜色.另外,为什么要使用.equals(null)而不是== null?

JTable's default renderer is a single instance for the entire table shared across multiple cells. Once you're setting the foreground, it will be set for all usages of it. You should set it back to the default color when the value is not null. Also, why are you using .equals(null) instead of == null?