Java开发网 Java开发网
注册 | 登录 | 帮助 | 搜索 | 排行榜 | 发帖统计  

您没有登录

» Java开发网 » Java SE 综合讨论区  

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
flat modethreaded modego to previous topicgo to next topicgo to back
作者 各大虾帮忙看看~谢谢
kakaka0





发贴: 6
积分: 0
于 2004-12-02 10:54 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
我的程序不知道什么错误,我是菜鸟帮帮忙吧!!
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Adder implements ActionListener
{
  JFrame AdderFame;
  JTextField TOprand1;
  JTextField TOprand2;
  JLabel LAdd,LSum;
  JButton BAdd;
  int i=0;
  public Adder()
  {
    AdderFrame=new JFrame("AdderFrame");
    TOprand1=new JTextField("0.0");
    TOprand2=new JTextField("0.0");
    LAdd=new JLabel("+");
    LSum=new JLabel("= ");
    BAdd=new JButton("Add!");
    AdderFrame.getContentPane().setLayout(new FlowLayout());
    AdderFrame.getContentPane().add(TOprand1);
    AdderFrame.getContentPane().add(LAdd);
    AdderFrame.getContentPane().add(TOprand2);
    AdderFrame.getContentPane().add(LSum);
    AdderFrame.getContentPane().add(BAdd);
    AdderFrame.pack();
    AdderFrame.setVisible(true);
    
    
    BAdd.addActionListener(this);
    
    public void actionPerformed(ActionEvent event)
    {
      i=(i=1)%2;
       if(i==1)
       {
         int sum=(int)(Double.valueOf(TOprand1.getText()).doubleValue()+Double.valueOf(TOprand.getText()).doubleValue());
         LSum.setText("="+sum);
       }else{
         TOpand1.setText("0.0");
         TOpand2.serText("0.0");
         LSum.setText("=");
       };
    }
    AdderFrame.addWindowListener(new WindowAdapter()
    {
      public void windowClosing(WindowEvent e)
      {
        System.exit(0);
      }
    });
  }
  public static void main(String[] args){
    Adder adder=new Adder();}
}
错误:--------------------Configuration: <Default>--------------------
C:\Adder.java:32: illegal start of expression
public void ActionPerformed(ActionEvent event)
^
1 error

Process completed.




话题树型展开
人气 标题 作者 字数 发贴时间
3503 各大虾帮忙看看~谢谢 kakaka0 1650 2004-12-02 10:54
2910 Re:各大虾帮忙看看~谢谢 shoulders 1962 2004-12-02 11:07
2942 Re:各大虾帮忙看看~谢谢 kakaka0 12 2004-12-03 08:37

flat modethreaded modego to previous topicgo to next topicgo to back
  已读帖子
  新的帖子
  被删除的帖子
Jump to the top of page

   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923