Re: JList getSelectedValue returning null



soup_or_power@xxxxxxxxx wrote:

> Can anyone tell me why a JList based on the following model returns
> null?
> Thanks!

> private Vector data = null;
>
> public KeyValueListModel(Vector data) {
> System.out.println("hello10");
> if (null == data) {
> throw new NullPointerException("Null Pointer Exception in data");
> }
>
> this.data = data;
> }
>

The other posters on the thread had sensible comments. I think the key is in
the constructor above. "data" is initialized to null and if it is found to
be null in your constructor (which it always will be) it throws always when
you use this.
--
Groeten van/regards

Menno
.



Relevant Pages