这个程序怎么运行不了?

yuucyf 2006-05-27 11:37:48
package converttodollar;

import java.io.*;
import java.applet.Applet;
import java.awt.*;
import java.awt.event.*;




public class convertToDollar extends Applet implements ActionListener
{
Label label1,label2,label3 ;
TextField textField1,textField2 ;
Button button1 ;

public void init()
{
this.setLayout(new GridLayout(3,2,10,10));
label1 = new Label("人民币") ;
add(label1) ;
textField1 = new TextField(12) ;
add(textField1) ;
label2 = new Label("汇率");
add(label2) ;
textField2 = new TextField(8) ;
add(textField2);
button1 = new Button("转换成为欧元") ;
add(button1) ;
button1.addActionListener(this) ;
label3 = new Label() ;
add(label3) ;
}

public void actionPerformed(ActionEvent e)
{
String s1 = textField1.getText() ;
double x1 = Double.parseDouble(s1) ;
String s2 = textField2.getText() ;
double x2 = Double.parseDouble(s2) ;
double total = x1 * x2 ;
label3.setText("转换后的结果为= " + total + "$") ;

}

}

错误提示:
java.lang.NoSuchMethodError: main
Exception in thread "main"


大家帮忙看看,谢谢了!
...全文
217 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
coolroy2000 2006-05-31
  • 打赏
  • 举报
回复
在运行配置 设置 applet方式 和 Main Class。
default_class 2006-05-31
  • 打赏
  • 举报
回复
在runtime configurations里添加运行程序的路径
default_class 2006-05-31
  • 打赏
  • 举报
回复
要添加运行Applet的PATH
trumplet 2006-05-31
  • 打赏
  • 举报
回复
在jbuilder里,要先设置“运行配置”里的Main Class
yuucyf 2006-05-31
  • 打赏
  • 举报
回复
谢谢!
我配置成为Applitation了!!
yuucyf 2006-05-30
  • 打赏
  • 举报
回复
我是在Jbuilder里运行的!!!
trumplet 2006-05-30
  • 打赏
  • 举报
回复
你的程序是一个Applet,需要在网页中运行,或在小程序查看器里运行。
yuucyf 2006-05-29
  • 打赏
  • 举报
回复
大虾在哪呀?
可以帮帮忙吗!谢谢了!
加分的!
yuucyf 2006-05-28
  • 打赏
  • 举报
回复
哪位知道了帮下忙!谢谢了!

50,535

社区成员

发帖
与我相关
我的任务
社区描述
Java相关技术讨论
javaspring bootspring cloud 技术论坛(原bbs)
社区管理员
  • Java相关社区
  • 小虚竹
  • 谙忆
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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