资源简介
这个java程序是我自己写的,当时想在网上找一个,发现别人提供的和自己需要的不一样,现在我把自己的代码放到网上,希望大家能够提出意见,给希望给大家帮助。
代码片段和文件信息
import java.awt.Button;
import java.awt.FlowLayout;
import java.awt.GridLayout;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.lang.reflect.Field;
import java.util.linkedList;
import javax.swing.JButton;
import javax.swing.Jframe;
import javax.swing.JPanel;
import javax.swing.JTextField;
import org.omg.CosNaming.IstringHelper;
class Point{
int x y;
public double getX() {
return x;
}
public void setX(int x) {
this.x = x;
}
public double getY() {
return y;
}
public void setY(int y) {
this.y = y;
}
public Point() {
// TODO Auto-generated constructor stub
x = 0;
y = 0;
}
public Point(int x int y) {
super();
this.x = x;
this.y = y;
}
void setLocation(int x int y){
this.x = x;
this.y = y;
}
}
public class JSQ extends Jframe{
static linkedList List = new linkedList();
static linkedList numbers = new linkedList();
static linkedList kuohao = new linkedList();
// static boolean alreadypoint = false;
JButton clear chexiao lkuohao rkuohao;
JButton jiajiancheng chu equals;
JButton number[];//one two tree four five six seven eight nine zero;
JButton point;
JButton button[];
JTextField field;
MouseListener listener[];
static String strings;
class Adapter extends MouseAdapter{
String str;
public Adapter(JButton button) {
// TODO Auto-generated constructor stub
str = button.getText();
System.out.println(str);
}
/**
* 判断是否是数字
* @param laststr
* @return
*/
private boolean isnumber(String laststr){
if(laststr.equalsIgnoreCase(“0“) || laststr.equalsIgnoreCase(“1“) || laststr.equalsIgnoreCase(“2“) ||
laststr.equalsIgnoreCase(“3“) || laststr.equalsIgnoreCase(“4“) || laststr.equalsIgnoreCase(“5“) ||
laststr.equalsIgnoreCase(“6“) || laststr.equalsIgnoreCase(“7“) || laststr.equalsIgnoreCase(“8“) ||
laststr.equalsIgnoreCase(“9“)){
return true;
}
else return false;
}
/**
* 判断是否已经有了小数点
* @return
*/
private boolean isalreadypoint(){
int i = 0;
if(List.size()>0){
for(i = List.size() - 1; i >= 0; i--){
if(! isnumber(List.get(i))){
break;
}
}
if(i >= 0){
if(List.get(i).equalsIgnoreCase(“.“)){
return true;
}
else
return false;
}
else return false;
}
else
return false;
}
/**
* 判断是否为空字符
*/
private boolean isnull(String laststr){
if(laststr.equalsIgnoreCase(““) ){
return true;
}
return false;
}
/**
* 判断是否为运算符
* @param laststr
* @return
*/
private boolean isyun
评论
共有 条评论