JAVA编译时找不到符号
代码如下:importjava.awt.*;importjava.awt.event.*;publicclassroundextendsFrameimplementsAc...
代码如下:
import java.awt.*;
import java.awt.event.*;
public class round extends Frame implements ActionListener
{
TextField t1,t2,t3,t4;
Button b1;
round()
{
setLayout(new FlowLayout());
t1=new TextField(20);
t2=new TextField(20);
t3=new TextField(20);
t4=new TextField(20);
b1=new Button("计算");
add(new Lable("输入圆的半径:"));
add(t1);
add(new Lable("得出圆的直径:"));
add(t2);
add(new Lable("得出圆的面积:"));
add(t3);
add(new Lable("得出圆的周长:"));
add(t4);
add(b1);
addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
}
);
b1.addActionListener(this);
setVisible(ture);
setBounds(400,400,440,400);
validate();
}
public void actionperformed(ActionEvent e)
{
double temp,r,a,c;
temp=Double.pareDoublet1.getText();
r=2*temp;
a=3.14*temp*temp;
c=2*3.14*temp;
t2.setText(String.valueOf(r));
t3.setText(String.valueOf(r));
t4.setText(String.valueOf(r));
}
public static void main(String args[])
{
new round();
}
}
编译:round.java:3: round 不是抽象的,并且未覆盖 java.awt.event.ActionListener 中的抽
象方法 actionPerformed(java.awt.event.ActionEvent)
public class round extends Frame implements ActionListener
^
round.java:15: 找不到符号
符号: 类 Lable
位置: 类 round
add(new Lable("输入圆的半径:"));
^
round.java:17: 找不到符号
符号: 类 Lable
位置: 类 round
add(new Lable("得出圆的直径:"));
^
round.java:19: 找不到符号
符号: 类 Lable
位置: 类 round
add(new Lable("得出圆的面积:"));
^
round.java:21: 找不到符号
符号: 类 Lable
位置: 类 round
add(new Lable("得出圆的周长:"));
^
round.java:33: 找不到符号
符号: 变量 ture
位置: 类 round
setVisible(ture);
^
round.java:40: 找不到符号
符号: 变量 pareDoublet1
位置: 类 java.lang.Double
temp=Double.pareDoublet1.getText();
^
7 错误
这是怎么回事啊? 展开
import java.awt.*;
import java.awt.event.*;
public class round extends Frame implements ActionListener
{
TextField t1,t2,t3,t4;
Button b1;
round()
{
setLayout(new FlowLayout());
t1=new TextField(20);
t2=new TextField(20);
t3=new TextField(20);
t4=new TextField(20);
b1=new Button("计算");
add(new Lable("输入圆的半径:"));
add(t1);
add(new Lable("得出圆的直径:"));
add(t2);
add(new Lable("得出圆的面积:"));
add(t3);
add(new Lable("得出圆的周长:"));
add(t4);
add(b1);
addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
}
);
b1.addActionListener(this);
setVisible(ture);
setBounds(400,400,440,400);
validate();
}
public void actionperformed(ActionEvent e)
{
double temp,r,a,c;
temp=Double.pareDoublet1.getText();
r=2*temp;
a=3.14*temp*temp;
c=2*3.14*temp;
t2.setText(String.valueOf(r));
t3.setText(String.valueOf(r));
t4.setText(String.valueOf(r));
}
public static void main(String args[])
{
new round();
}
}
编译:round.java:3: round 不是抽象的,并且未覆盖 java.awt.event.ActionListener 中的抽
象方法 actionPerformed(java.awt.event.ActionEvent)
public class round extends Frame implements ActionListener
^
round.java:15: 找不到符号
符号: 类 Lable
位置: 类 round
add(new Lable("输入圆的半径:"));
^
round.java:17: 找不到符号
符号: 类 Lable
位置: 类 round
add(new Lable("得出圆的直径:"));
^
round.java:19: 找不到符号
符号: 类 Lable
位置: 类 round
add(new Lable("得出圆的面积:"));
^
round.java:21: 找不到符号
符号: 类 Lable
位置: 类 round
add(new Lable("得出圆的周长:"));
^
round.java:33: 找不到符号
符号: 变量 ture
位置: 类 round
setVisible(ture);
^
round.java:40: 找不到符号
符号: 变量 pareDoublet1
位置: 类 java.lang.Double
temp=Double.pareDoublet1.getText();
^
7 错误
这是怎么回事啊? 展开
6个回答
展开全部
Lable -> Label
ture -> true
Double.pareDoublet1 -》 Double.parseDouble (t1.getText())
actionperformed -》actionPerformed
完整如下
import java.awt.Button;
import java.awt.FlowLayout;
import java.awt.Frame;
import java.awt.Label;
import java.awt.TextField;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
public class round extends Frame implements ActionListener {
TextField t1, t2, t3, t4;
Button b1;
public round() {
setLayout(new FlowLayout());
t1 = new TextField(20);
t2 = new TextField(20);
t3 = new TextField(20);
t4 = new TextField(20);
b1 = new Button("计算");
add(new Label("输入圆的半径:"));
add(t1);
add(new Label("得出圆的直径:"));
add(t2);
add(new Label("得出圆的面积:"));
add(t3);
add(new Label("得出圆的周长:"));
add(t4);
add(b1);
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
b1.addActionListener(this);
setVisible(true);
setBounds(400, 400, 440, 400);
validate();
}
public void actionPerformed(ActionEvent e) {
double temp, r, a, c;
temp = Double.parseDouble(t1.getText());
r = 2 * temp;
a = 3.14 * temp * temp;
c = 2 * 3.14 * temp;
t2.setText(String.valueOf(r));
t3.setText(String.valueOf(r));
t4.setText(String.valueOf(r));
}
public static void main(String args[]) {
new round();
}
}
ture -> true
Double.pareDoublet1 -》 Double.parseDouble (t1.getText())
actionperformed -》actionPerformed
完整如下
import java.awt.Button;
import java.awt.FlowLayout;
import java.awt.Frame;
import java.awt.Label;
import java.awt.TextField;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
public class round extends Frame implements ActionListener {
TextField t1, t2, t3, t4;
Button b1;
public round() {
setLayout(new FlowLayout());
t1 = new TextField(20);
t2 = new TextField(20);
t3 = new TextField(20);
t4 = new TextField(20);
b1 = new Button("计算");
add(new Label("输入圆的半径:"));
add(t1);
add(new Label("得出圆的直径:"));
add(t2);
add(new Label("得出圆的面积:"));
add(t3);
add(new Label("得出圆的周长:"));
add(t4);
add(b1);
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
b1.addActionListener(this);
setVisible(true);
setBounds(400, 400, 440, 400);
validate();
}
public void actionPerformed(ActionEvent e) {
double temp, r, a, c;
temp = Double.parseDouble(t1.getText());
r = 2 * temp;
a = 3.14 * temp * temp;
c = 2 * 3.14 * temp;
t2.setText(String.valueOf(r));
t3.setText(String.valueOf(r));
t4.setText(String.valueOf(r));
}
public static void main(String args[]) {
new round();
}
}
追问
这个编译是通过了,但是为什么那个计算功能没有实现啊?
追答
t2.setText(String.valueOf(r));
t3.setText(String.valueOf(r));
t4.setText(String.valueOf(r));
改成
t2.setText(String.valueOf(r));
t3.setText(String.valueOf(a));
t4.setText(String.valueOf(c));
你所有文本框都放的r
展开全部
add(new Lable("输入圆的半径:"));
这里,注意看!!(Lable)是个神马意思?写错啦!!
这里,注意看!!(Lable)是个神马意思?写错啦!!
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
import java.awt.Button;
import java.awt.FlowLayout;
import java.awt.Frame;
import java.awt.Label;
import java.awt.TextField;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
public class Test extends Frame implements ActionListener{
/**
* @param args
*/
TextField t1,t2,t3,t4;
Button b1;
Test()
{
setLayout(new FlowLayout());
new TextField();
t1=new TextField(20);
t2=new TextField(20);
t3=new TextField(20);
t4=new TextField(20);
b1=new Button("计算");
add(new Label("输入圆的半径:"));
add(t1);
add(new Label("得出圆的直径:"));
add(t2);
add(new Label("得出圆的面积:"));
add(t3);
add(new Label("得出圆的周长:"));
add(t4);
add(b1);
addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
}
);
b1.addActionListener(this);
setVisible(true);
setBounds(400,400,440,400);
validate();
}
public void actionperformed(ActionEvent e)
{
double temp,r,a,c;
temp=Double.parseDouble(t1.getText());
r=2*temp;
a=3.14*temp*temp;
c=2*3.14*temp;
t2.setText(String.valueOf(r));
t3.setText(String.valueOf(r));
t4.setText(String.valueOf(r));
}
public static void main(String args[])
{
new Test();
}
public void actionPerformed(ActionEvent arg0) {
// TODO Auto-generated method stub
}
}
这个编译通过了,把Test换成round可以直接用了
import java.awt.FlowLayout;
import java.awt.Frame;
import java.awt.Label;
import java.awt.TextField;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
public class Test extends Frame implements ActionListener{
/**
* @param args
*/
TextField t1,t2,t3,t4;
Button b1;
Test()
{
setLayout(new FlowLayout());
new TextField();
t1=new TextField(20);
t2=new TextField(20);
t3=new TextField(20);
t4=new TextField(20);
b1=new Button("计算");
add(new Label("输入圆的半径:"));
add(t1);
add(new Label("得出圆的直径:"));
add(t2);
add(new Label("得出圆的面积:"));
add(t3);
add(new Label("得出圆的周长:"));
add(t4);
add(b1);
addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
}
);
b1.addActionListener(this);
setVisible(true);
setBounds(400,400,440,400);
validate();
}
public void actionperformed(ActionEvent e)
{
double temp,r,a,c;
temp=Double.parseDouble(t1.getText());
r=2*temp;
a=3.14*temp*temp;
c=2*3.14*temp;
t2.setText(String.valueOf(r));
t3.setText(String.valueOf(r));
t4.setText(String.valueOf(r));
}
public static void main(String args[])
{
new Test();
}
public void actionPerformed(ActionEvent arg0) {
// TODO Auto-generated method stub
}
}
这个编译通过了,把Test换成round可以直接用了
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
import java.awt.Button;
import java.awt.FlowLayout;
import java.awt.Frame;
import java.awt.Label;
import java.awt.TextField;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
public class Test extends Frame implements ActionListener{
/**
* @param args
*/
TextField t1,t2,t3,t4;
Button b1;
Test()
{
setLayout(new FlowLayout());
new TextField();
t1=new TextField(20);
t2=new TextField(20);
t3=new TextField(20);
t4=new TextField(20);
b1=new Button("计算");
add(new Label("输入圆的半径:"));
add(t1);
add(new Label("得出圆的直径:"));
add(t2);
add(new Label("得出圆的面积:"));
add(t3);
add(new Label("得出圆的周长:"));
add(t4);
add(b1);
addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
}
);
b1.addActionListener(this);
setVisible(true);
setBounds(400,400,440,400);
validate();
}
public void actionperformed(ActionEvent e)
{
double temp,r,a,c;
temp=Double.parseDouble(t1.getText());
r=2*temp;
a=3.14*temp*temp;
c=2*3.14*temp;
t2.setText(String.valueOf(r));
t3.setText(String.valueOf(r));
t4.setText(String.valueOf(r));
}
public static void main(String args[])
{
new Test();
}
public void actionPerformed(ActionEvent arg0) {
// TODO Auto-generated method stub
}
}
import java.awt.FlowLayout;
import java.awt.Frame;
import java.awt.Label;
import java.awt.TextField;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
public class Test extends Frame implements ActionListener{
/**
* @param args
*/
TextField t1,t2,t3,t4;
Button b1;
Test()
{
setLayout(new FlowLayout());
new TextField();
t1=new TextField(20);
t2=new TextField(20);
t3=new TextField(20);
t4=new TextField(20);
b1=new Button("计算");
add(new Label("输入圆的半径:"));
add(t1);
add(new Label("得出圆的直径:"));
add(t2);
add(new Label("得出圆的面积:"));
add(t3);
add(new Label("得出圆的周长:"));
add(t4);
add(b1);
addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
}
);
b1.addActionListener(this);
setVisible(true);
setBounds(400,400,440,400);
validate();
}
public void actionperformed(ActionEvent e)
{
double temp,r,a,c;
temp=Double.parseDouble(t1.getText());
r=2*temp;
a=3.14*temp*temp;
c=2*3.14*temp;
t2.setText(String.valueOf(r));
t3.setText(String.valueOf(r));
t4.setText(String.valueOf(r));
}
public static void main(String args[])
{
new Test();
}
public void actionPerformed(ActionEvent arg0) {
// TODO Auto-generated method stub
}
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
包没导入完全 。
建意用 mycelipse .
快捷键 ctrl + shift + o 自动导包 。
最好在熟悉后能记住这些包 。
建意用 mycelipse .
快捷键 ctrl + shift + o 自动导包 。
最好在熟悉后能记住这些包 。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
1:public
void
actionperformed(ActionEvent
e)应该是public
void
actionPerformed(ActionEvent
e)
//JAVA区分大小写2:Lable应该写成Label3:temp=Double.pareDoublet1.getText();应该写成temp
=
Double.parseDouble(t1.getText());4:setVisible(ture);应写成setVisible(true);可以了。
void
actionperformed(ActionEvent
e)应该是public
void
actionPerformed(ActionEvent
e)
//JAVA区分大小写2:Lable应该写成Label3:temp=Double.pareDoublet1.getText();应该写成temp
=
Double.parseDouble(t1.getText());4:setVisible(ture);应写成setVisible(true);可以了。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询