getItemCountpublic int getItemCount() Gets the number of items in the list.Returns:the number of items in the listSince:JDK1.1See Also:getItem(int)或者 public int countItems() Deprecated. As of JDK version 1.1, replaced by getItemCount(). 看看你的jdk是多少推荐有第一种
boolean isEmpty();
也有,int size();
List a=new List(4); ?????Interface有构造函数吗?
.........
if (a.getItemCount()==0) ??????List Class有这个函数吗?
也沒有isEmpty()這個方法
size不可用, 有一個List.getLastVisibleIndex()方法
if(List.getLastVisibleIndex()==-1){//為空
}
哈是楼主自己说列表框当然就是这个了 看清楚点
inprise_lyj(只愛一點點) :怎么会没有?jdk1.4
Gets the number of items in the list.Returns:the number of items in the listSince:JDK1.1See Also:getItem(int)或者
public int countItems()
Deprecated. As of JDK version 1.1, replaced by getItemCount().
看看你的jdk是多少推荐有第一种
也可以用myList == null || myList.size() == 0要注意的是如果myList = null; 你直接用myList.size() == 0 来判断的话会跑出异常的
java.util.List Interface
and
java.awt.List是不一样的!!!!!!!!!!