不能创建对象

subarashii 2009-04-30 09:30:53
不能创建test对象。这是个向导式对话框,现在要创建test对象 但是不知为何不行

public class NewChannelWizard extends Wizard {
public static String cb;
private NewChannelOne one = new NewChannelOne();
private NewChannelTwo two = new NewChannelTwo();
test t=new test();
public NewChannelWizard() {
this.addPage(one);
this.addPage(two);
this.setWindowTitle("New Channel");

}

@Override
public boolean performFinish() {

String channelurl ;
String channel_name ;
String category_name ;
URL feedUrl = null;
System.out.println("1");
channelurl = one.text.getText();
channel_name = two.text.getText();
category_name = two.combo.getText();

try {
t.done(feedUrl,category_name);
} catch (IllegalArgumentException e) {
// TODO Auto-generated catch block
System.out.println("2");
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
System.out.println("3");
e.printStackTrace();
} catch (FeedException e) {
// TODO Auto-generated catch block
System.out.println("4");
e.printStackTrace();
}


ChannelView.db.addChannel(channelurl, channel_name, category_name,null );// 作者从解析器获取
ChannelView.initdata();
ChannelView.tree.setInput(ChannelView.data);
ChannelView.tree.refresh();



return true;
}
public boolean canFinish(){
if(this.getContainer().getCurrentPage()==two){
return true;
}
else
return false;

}




}


public class test {

public test(){
System.out.println("test");

}
public void done(URL channelurl,String category_name) throws IllegalArgumentException, IOException, FeedException{
int articlecount;
String author = null;
String content= null;
String pubdate= null;
String articleurl= null;
String title = null;
URL feedUrl = null;
Listen lis=new Listen(feedUrl);
List entry=lis.parseroutput.getEntries();
articlecount=entry.size();
for(int i=0;i<articlecount;i++){
articleurl=lis.parseroutput.getLink(i);
title=lis.parseroutput.getTitle(i);
pubdate=lis.parseroutput.getPubDate(i).toString();
content=lis.parseroutput.getDescription(i);
author=lis.parseroutput.getAuthor(i);
ChannelView.db.addArticle(articleurl,title, pubdate, content, channelurl.toString(), category_name, author);
}

}

}
...全文
87 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
taofan911 2009-04-30
  • 打赏
  • 举报
回复
你这个程序的一部分把 ,如果不能 new test 说明你test类有错误,我大概看了下,test 基本格式没有问题.
请看你的test类 红色字部分
public void done(URL channelurl,String category_name) throws IllegalArgumentException, IOException, FeedException{
改成
public void done(URL channelurl,String category_name) throws Exception{
原来抛异常,我在Eclipse下 这里报错误 ,所以我改成Exception异常,就是模糊的抛下。Excetpion是所有异常的父类么.
subarashii 2009-04-30
  • 打赏
  • 举报
回复
因为要创建这个对象 所以 这个对话框都不能正常弹出 。如果除掉test语句 正常弹出
subarashii 2009-04-30
  • 打赏
  • 举报
回复
恩 wizard暂时能弹出来了 似乎找到问题了~

62,616

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧