展开全部
String[] data = {"one", "two", "three", "four"};
JList myList = new JList(data);
// Create a JList that displays the superclasses of JList.class, by
// creating it with a Vector populated with this data
Vector superClasses = new Vector();
Class rootClass = javax.swing.JList.class;
for(Class cls = rootClass; cls != null; cls = cls.getSuperclass()) {
superClasses.addElement(cls);
}
JList myList = new JList(superClasses);
// The automatically created model is stored in JList's "model"
// property, which you can retrieve
ListModel model = myList.getModel();
for(int i = 0; i < model.getSize(); i++) {
System.out.println(model.getElementAt(i));
}
你要从0开始。
JList myList = new JList(data);
// Create a JList that displays the superclasses of JList.class, by
// creating it with a Vector populated with this data
Vector superClasses = new Vector();
Class rootClass = javax.swing.JList.class;
for(Class cls = rootClass; cls != null; cls = cls.getSuperclass()) {
superClasses.addElement(cls);
}
JList myList = new JList(superClasses);
// The automatically created model is stored in JList's "model"
// property, which you can retrieve
ListModel model = myList.getModel();
for(int i = 0; i < model.getSize(); i++) {
System.out.println(model.getElementAt(i));
}
你要从0开始。
追问
我也想从0 开始,老师什么都没讲,我只学了一个学期最基础的java,而老师只给3天多的时间来完成整个程序,我也没办法啊.有没有具体点的代码
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询