Topic: 代码问题

  Print this page

1.代码问题 Copy to clipboard
Posted by: lonve
Posted on: 2005-12-17 16:22


import java.awt.*;
import java.awt.event.*;
import java.applet.*;
public class AppAppletInOut extends Applet implements Actionlistener{
public static void main(string args[]){
Frame frame=new Frame=();
AppAppletInOut app=new AppAppletInOut=();
app.init();
frame.add(app) ;
frame.setsize(400,100);
frame.show();
}
TextField in=new TextField(6);
Button btn=new Button("??");
Label out=new Label(" ");
public void init(){
setLayout(new floatLayout());
add(in) ;
add(btn);
add(out);
btn.addActionListener(this);

}

public void actionperformed(ActionEven e){

String s=in.getText();
double d=Double.parseDouble(s);
double q=d*d*d;
out.setText(d+"µÄÁ¢·½ÊÇ"+q);






}
}

各位帮我看一下,这段代码有什么问题

2.Re:代码问题 [Re: lonve] Copy to clipboard
Posted by: why
Posted on: 2005-12-27 08:06

> implements Actionlistener

> Frame frame=new Frame=();
> AppAppletInOut app=new AppAppletInOut=();

> setLayout(new floatLayout());

> public void actionperformed(ActionEven e){
Did you read your code after copying or typing?
Have you ever tried to compile your code? Have you ever written a Java program?

Dead
This board is "Java SE进阶", I don't think you have learned the basics to 进阶


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923