标题:这是怎么回事a
只看楼主
forests
Rank: 1
等 级:新手上路
帖 子:53
专家分:0
注 册:2006-3-11
 问题点数:0 回复次数:2 
这是怎么回事a
import java.awt.*;
import java.applet.*;
public class GraphicsPrime extends Applet implements ActionListener {
Label prompt;
TextField input;
public void init(){
prompt = new Label("Enter a year:");
input = new TextField(3);
input.addActionListener(this);
add(prompt);add(input);
}
public void paint(Graphics g){
int year;
boolean leap;
year = Integer.parseInt(input.getText());
if(year%100==0)
if(year%400==0)leap=ture;
else leap=ture;
else
if(year%4==0)
leap=ture;
else
leap=false;
if(leap)
g.drawString("The is a leap year.",60,80);
else
g.drawString("The is not a leap year.",60,80);
}
public void actionPerformed(ActionEvent e){
repaint();
}
}
我怎么也搞不清楚里面的错误啊,请各位看看哪错了
搜索更多相关主题的帖子: public import Enter 
2006-03-30 20:08
飘飘叶子
Rank: 7Rank: 7Rank: 7
等 级:贵宾
威 望:34
帖 子:597
专家分:10
注 册:2005-8-17
得分:0 
import java.awt.*;
import java.awt.event.*; //没有导入这个包
import java.applet.*;
public class GraphicsPrime extends Applet implements ActionListener {
Label prompt;
TextField input;
public void init(){
prompt = new Label("Enter a year:");
input = new TextField(3);
input.addActionListener(this);
add(prompt);add(input);
}
public void paint(Graphics g){
int year;
boolean leap;
year = Integer.parseInt(input.getText());
if(year%100==0)
if(year%400==0)leap=true; //true拼写错误...
else leap=true;
else
if(year%4==0)
leap=true;
else
leap=false;
if(leap)
g.drawString("The is a leap year.",60,80);
else
g.drawString("The is not a leap year.",60,80);
}
public void actionPerformed(ActionEvent e){
repaint();
}
}


细心一点……

向着软件工程师的目标前进!
2006-03-30 20:30
forests
Rank: 1
等 级:新手上路
帖 子:53
专家分:0
注 册:2006-3-11
得分:0 
哇,斑竹厉害,比我们老师强啊....
谢谢哈

好好学习,天天想上
2006-03-30 20:36



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-54037-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.880258 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved