好吧,我有另一个疑问。我列表中的每一行都有这些组件 标签 - 按钮( - ) - 按钮(+) - 标签(0)当我点击按钮(+)时我需要获得Label(0)值并增加一个单位。所以我需要获得Label(0)引用来设置新值。我试图找到这个组件:
Label l = (Label)findByName("lblVal", c.getParent());
Label l = findLblVal();
Label l = findLblVal(c);
Label l = findLblVal(c.getPrent());
List Action Listener中的代码是:
List list = (List)c;
Button b = ((GenericListCellRenderer)list.getRenderer()).extractLastClickedComponent();
if(b != null)
{
//lblVal is the name of my component in the renderer
//MY PROBLEM IS HERE, I GET NULL REFERENCE
Label l = findLblVal(c);
}
但我总是得到一个空引用。我如何获得对该组件的引用?