secantapp中创建一个secantframe的实例,调用它的方法就行
也可以直接使用静态方法
也可以直接使用静态方法
解决方案 »
- 正则问题
- 数据库中二进制 取出后 如何转换成 字符串?
- sql2000的Money类型与java中的数据类型不兼容?
- 求《Applying UML and Patterns》第三版
- 一个有关菜单的问题
- 【急!高分求助】关于JAVA混淆器的使用的问题
- 怎样用java语言编程,修改注册表
- 什么是java!
- 各位Java大蝦,我搞了3年的Delphi,覺得沒什么意思,想搞Java!不知哪裡有Java2的電子書籍可以下載請告知不甚感激!
- JAVA 中的按纽及相应的控件的位置能否自己定义?应如何设置
- 我是一个初学者,刚刚开始做聊天室程序,遇到一个问题怎么也解决不了,请大家帮忙看看
- Java中使用ObjectInputStream,ObjectOutputStream转递对象的问题
double x1do,x2do,toldo; //double[] is ok
int maxin;
public double getX1(){
return x1do;
}
...
}//
win.getX1()
...
String x1tr,x2tr,toltr,maxtr;
Double x1do,x2do,toldo;
Integer maxin;
public double getX1(){
return x1do;}
public double getX2(){
return x2do;}
public double getX3(){
return toldo;}
public double getX4(){
return maxin;}
if (e.getSource()==b1){
x1tr=x1.getText();
x1do=Double.valueOf(x1tr);
x2tr=x2.getText();
x2do=Double.valueOf(x2tr); toltr=tol.getText();
toldo=Double.valueOf(toltr); maxtr=max.getText();
maxin=Integer.valueOf(maxtr);
}
}
import java.awt.*;
public class SecantApp {public static void main(String args[]){
SecantFrame win = new SecantFrame("");
win.setVisible(true);
Secant myEq= new MySecant(win.getX1(),win.getX2(),win.getX3(),win.getX4());
myEq.solve();
}
}楼上的,是这样吗?编译出错啊
...
private String x1tr,x2tr,toltr,maxtr;
private Double x1do,x2do,toldo;
private Integer maxin;
public double getX1()
{
return x1do;
}
public double getX2()
{
return x2do;
}
public double getX3()
{
return toldo;
}
public double getX4()
{
return maxin;
}public void actionPerformed(ActionEvent e){ if (e.getSource()==b1){
x1tr=x1.getText();
x1do=Double.valueOf(x1tr);
x2tr=x2.getText();
x2do=Double.valueOf(x2tr); toltr=tol.getText();
toldo=Double.valueOf(toltr); maxtr=max.getText();
maxin=Integer.valueOf(maxtr);
}
}
import java.awt.*;
public class SecantApp {public static void main(String args[]){
SecantFrame win = new SecantFrame("");
win.setVisible(true);
Secant myEq= new MySecant(win.getX1(),win.getX2(),win.getX3(),win.getX4());
myEq.solve();
}
}
.\SecantFrame.java:81: incompatible types
found : java.lang.Double
required: double
return x1do;
^
.\SecantFrame.java:85: incompatible types
found : java.lang.Double
required: double
return x2do;
^
.\SecantFrame.java:89: incompatible types
found : java.lang.Double
required: double
return toldo;
^
.\SecantFrame.java:93: incompatible types
found : java.lang.Integer
required: int
return maxin;
^
4 errors
java.lang.Double和double有什么区别啊?
...
private String x1tr,x2tr,toltr,maxtr;
//private Double x1do,x2do,toldo;
private double x1do,x2do,toldo;
//private Integer maxin;
private int maxin;
..
found : java.lang.Double
required: double
x1do=Double.valueOf(x1tr);
^
.\SecantFrame.java:105: incompatible types
found : java.lang.Double
required: double
x2do=Double.valueOf(x2tr);
^
.\SecantFrame.java:108: incompatible types
found : java.lang.Double
required: double
toldo=Double.valueOf(toltr);
^
.\SecantFrame.java:111: incompatible types
found : java.lang.Integer
required: int
maxin=Integer.valueOf(maxtr);
^
4 errors
Double.parseDouble(x1tr);
Double.parseDouble(x2tr);
Double.parseDouble(toltr);
Integer.ParseInt(maxtr);
.\SecantFrame.java:102: cannot resolve symbol
symbol : method parseDouble (java.lang.String)
location: class SecantFrame
x1do=parseDouble(x1tr);
^
.\SecantFrame.java:105: cannot resolve symbol
symbol : method parseDouble (java.lang.String)
location: class SecantFrame
x2do=parseDouble(x2tr);
^
.\SecantFrame.java:108: cannot resolve symbol
symbol : method parseDouble (java.lang.String)
location: class SecantFrame
toldo=parseDouble(toltr);
^
.\SecantFrame.java:111: cannot resolve symbol
symbol : method parseInt (java.lang.String)
location: class SecantFrame
maxin=parseInt(maxtr);
^
4 errors