| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 2999 人关注过本帖
标题:报 java.lang.NumberFormatException: For input string: ""异常怎么解决 ...
只看楼主 加入收藏
xiaoyu2006
Rank: 1
等 级:新手上路
帖 子:64
专家分:0
注 册:2007-12-14
收藏
 问题点数:0 回复次数:0 
报 java.lang.NumberFormatException: For input string: ""异常怎么解决
import java.awt.TextField;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import
import java.util.*;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import javax.swing.JTextField;
//界面实现
public class CaiPiao extends JFrame {
    JTextField jf = new JTextField(20);
    public CaiPiao(){
        super("双色球");
        setSize(300,400);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setVisible(true);
        
        JTextField jf = new JTextField(20);
        JTextArea ja = new JTextArea(15,20);
        
        JLabel jl1 = new JLabel("彩票注数");
        JLabel jl2 = new JLabel("彩票号码");
        JPanel jp = new JPanel();
        JButton jb1 = new JButton("输出");
        JButton jb2 = new JButton("清空");
        jp.add(jl1);
        jp.add(jf);
        jp.add(jl2);
        jp.add(ja);
        jp.add(jb1);
        jp.add(jb2);
        BTActionListener bt = new BTActionListener(this);
        jb1.addActionListener(bt);
        jb2.addActionListener(new ClcActionListener(this));
        setContentPane(jp);
        show();
    }

    
    
    public static void main(String[] args) {
        CaiPiao cp = new CaiPiao();
        ShengCheng sc = new ShengCheng();
        System.out.println(sc.creat());
    }
}
//输出按钮监听器
class BTActionListener implements ActionListener{
    CaiPiao cp =null ;
    public BTActionListener(CaiPiao cp){
        this.cp = cp;
    }
    public void actionPerformed(ActionEvent arg0) throws NumberFormatException {
        ShengCheng sc = new ShengCheng();
            int lo = Integer.parseInt(cp.jf.getText());
            for(int i=0;i<lo;i++){    
                System.out.println(sc.creat());
                System.out.println("test !");
            }
                    
    }
        
}
搜索更多相关主题的帖子: input string java For lang 
2008-06-02 21:16
快速回复:报 java.lang.NumberFormatException: For input string: ""异常怎么解 ...
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.020749 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved