jList使用中问题的解决
2013-06-02 20:18
106 查看
新浪微博API提供了强大的功能,这两天玩儿的挺开心。
在用jList显示好友列表时出现了问题。
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
//new Haoyou().setVisible(true);
Haoyou haoyou = new Haoyou();
haoyou.setVisible(true);
haoyou.haoyouLiebiao();
}
});
}
public void haoyouLiebiao() {
String access_token = WeiboConfig.getValue("access_token");
String uid = WeiboConfig.getValue("uid");
Friendships fm = new Friendships();
fm.client.setToken(access_token);
Timeline tm = new Timeline();
tm.client.setToken(access_token);
DefaultListModel m = new DefaultListModel();
try {
UserWapper users = fm.getFriendsBilateral(uid);
for (User u : users.getUsers()) {
m.addElement(u.getName().toString());
}
System.out.println(m);
jList1.setModel(m);
} catch (WeiboException e) {
e.printStackTrace();
}
}
重点是在Main中新建对象!!
在用jList显示好友列表时出现了问题。
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
//new Haoyou().setVisible(true);
Haoyou haoyou = new Haoyou();
haoyou.setVisible(true);
haoyou.haoyouLiebiao();
}
});
}
public void haoyouLiebiao() {
String access_token = WeiboConfig.getValue("access_token");
String uid = WeiboConfig.getValue("uid");
Friendships fm = new Friendships();
fm.client.setToken(access_token);
Timeline tm = new Timeline();
tm.client.setToken(access_token);
DefaultListModel m = new DefaultListModel();
try {
UserWapper users = fm.getFriendsBilateral(uid);
for (User u : users.getUsers()) {
m.addElement(u.getName().toString());
}
System.out.println(m);
jList1.setModel(m);
} catch (WeiboException e) {
e.printStackTrace();
}
}
重点是在Main中新建对象!!
相关文章推荐
- 解决ssh中使用struts2验证框架提示错误后正确无法提交的问题
- 2016最新CocoaPods安装与使用,问题解决
- 使用clonezilla做Linux备份及还原出现的问题及解决方法
- spring boot使用i18n时properties文件中文乱码问题的解决方法
- css使用text-align: justify不能实现两段对其的问题解决方式
- 如何在Idea中使用svn,以及代码更新报错的问题解决
- 使用 eclipse时,出现如下问题:org.eclipse.swt.SWTError: No more handles的解决办法
- 使用Hibernate轻松解决java中date与datetime类型不兼容的问题
- NPM 使用及npm升级中问题解决
- Git 使用中显示“Another git process seems to be running in this repository...”问题解决
- Linq 此提供程序只支持对返回实体或投影(包含所有标识列)的有序查询使用 问题的解决
- 使用cruiseControl.net + TestDriven.net + TypeMock.net + vs2005 + vss2005进行敏捷开发遇到的问题(已解决!!)
- iOS开发中使用FMDB解决数据存储问题
- 解决使用专有网络的阿里云服务器无法远程连接的问题
- 解决win10或win8“你的电脑已脱机。请使用上次在此电脑上使用的密码登录”的问题
- 使用TableDiff实用工具解决事务复制中的问题
- phpcms v9二次开发及使用中各种问题解决方案(二)
- 使用m2e将工程转化为maven工程后eclipse报Plugin execution not covered by lifecycle configuration:xxx plugin问题的解决方法