본문내용
tr = \"9\";
tf.setText(str);
}
else if((JButton)obj == bt1[9]){
str = \"\";
tf.setText(str);
}
else if((JButton)obj == bt1[10]){
if(str!=\"0\")
str = str + \"0\";
else
str = \"0\";
tf.setText(str);
}
else if((JButton)obj == bt1[11]){
if(str!=\"0\"&& name1!=\"0\"){
switch(ring1){
case 1:
result = Double.parseDouble(name1)+ Double.parseDouble(str) ;
tf.setToolTipText(Double.toString(result));
str = Double.toString (result); //문자열로 변환
break;
case 2:
result =Double.parseDouble(name1)- Double.parseDouble(str) ;
tf.setToolTipText(Double.toString(result));
str = Double.toString (result);
break;
case 3:
result =Double.parseDouble(name1)* Double.parseDouble(str) ;
tf.setToolTipText(Double.toString(result));
str = Double.toString (result);
break;
case 4:
result = Double.parseDouble(name1)/ Double.parseDouble(str) ;
tf.setToolTipText(Double.toString(result));
str = Double.toString (result);
break;
}
}
else
str = \"0\";
tf.setText(str);
}
//연산자버튼
else if((JButton)obj == bt2[0]){
if(str!=\"0\")
{
tf.setText(str); //텍스트 필드에 Str 값을 넣어줌
name1 =str;
str=\"\";
ring1=1;
}
else
str = \"0\";
tf.setText(str);
}
else if((JButton)obj == bt2[1]){
if(str!=\"0\")
{
tf.setText(str);
name1 = str;
str=\"\";
ring1=2;
}
else
str = \"0\";
tf.setText(str);
}
else if((JButton)obj == bt2[2]){
if(str!=\"0\")
{
tf.setText(str);
name1 = str;
str = \"\";
ring1=3;
}
else
str = \"0\";
tf.setText(str);
}
else if((JButton)obj == bt2[3]){
if(str!=\"0\")
{
tf.setText(str);
name1 = str;
str=\"\";
ring1=4;
}
else
str = \"0\";
tf.setText(str);
}
}
}
tf.setText(str);
}
else if((JButton)obj == bt1[9]){
str = \"\";
tf.setText(str);
}
else if((JButton)obj == bt1[10]){
if(str!=\"0\")
str = str + \"0\";
else
str = \"0\";
tf.setText(str);
}
else if((JButton)obj == bt1[11]){
if(str!=\"0\"&& name1!=\"0\"){
switch(ring1){
case 1:
result = Double.parseDouble(name1)+ Double.parseDouble(str) ;
tf.setToolTipText(Double.toString(result));
str = Double.toString (result); //문자열로 변환
break;
case 2:
result =Double.parseDouble(name1)- Double.parseDouble(str) ;
tf.setToolTipText(Double.toString(result));
str = Double.toString (result);
break;
case 3:
result =Double.parseDouble(name1)* Double.parseDouble(str) ;
tf.setToolTipText(Double.toString(result));
str = Double.toString (result);
break;
case 4:
result = Double.parseDouble(name1)/ Double.parseDouble(str) ;
tf.setToolTipText(Double.toString(result));
str = Double.toString (result);
break;
}
}
else
str = \"0\";
tf.setText(str);
}
//연산자버튼
else if((JButton)obj == bt2[0]){
if(str!=\"0\")
{
tf.setText(str); //텍스트 필드에 Str 값을 넣어줌
name1 =str;
str=\"\";
ring1=1;
}
else
str = \"0\";
tf.setText(str);
}
else if((JButton)obj == bt2[1]){
if(str!=\"0\")
{
tf.setText(str);
name1 = str;
str=\"\";
ring1=2;
}
else
str = \"0\";
tf.setText(str);
}
else if((JButton)obj == bt2[2]){
if(str!=\"0\")
{
tf.setText(str);
name1 = str;
str = \"\";
ring1=3;
}
else
str = \"0\";
tf.setText(str);
}
else if((JButton)obj == bt2[3]){
if(str!=\"0\")
{
tf.setText(str);
name1 = str;
str=\"\";
ring1=4;
}
else
str = \"0\";
tf.setText(str);
}
}
}
소개글