| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 999 人关注过本帖
标题:"AWT-EventQueue-0" java.lang.NullPointerException 错误
取消只看楼主 加入收藏
oofire
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2010-5-26
结帖率:100%
收藏
已结贴  问题点数:10 回复次数:0 
"AWT-EventQueue-0" java.lang.NullPointerException 错误
    //计算按钮的事件监听类
    private class CalculateButtonActionListener implements ActionListener {
        public void actionPerformed(final ActionEvent e) {
            int uid = Integer.parseInt(keHuBianHao.getText().trim());
            int thisyear = nianFen.getSelectedIndex() + 2008;
            int thismonth = yueFen.getSelectedIndex() + 1;
            float yingJiaoFeiYong;
            float caiNuanFei;
            float reShuiFei;
            Parameter parameter = Dao.getParameter();

            int lastyear,lastmonth;
            if(thismonth == 1) {
                lastyear = thisyear - 1;
                lastmonth = 12;
            }else {
                lastyear = thisyear;
                lastmonth = thismonth - 1;
            }
            
            if(yongHuZhongLei.getSelectedIndex() == 0) {
                TbHeatKhHis thisMonthHis = new TbHeatKhHis();
                TbHeatKhHis lastMonthHis = new TbHeatKhHis();
                thisMonthHis = Dao.getMonthHeatKhHis(uid, thisyear, thismonth);
                lastMonthHis = Dao.getMonthHeatKhHis(uid, lastyear, lastmonth);
                if(yongHuXingZhi.getSelectedIndex() == 0) {
                    float thisMonthHeatDegree = Float.parseFloat(thisMonthHis.getHeatDegree());//278行
                    float lastMonthHeatDegree = Float.parseFloat(lastMonthHis.getHeatDegree());
                    float heatJumin = parameter.getHeatjumin();
                    caiNuanFei = (thisMonthHeatDegree - lastMonthHeatDegree)*heatJumin;
                //    caiNuanFei = (Float.parseFloat(thisMonthHis.getHeatDegree()) - Float.parseFloat(lastMonthHis.getHeatDegree()))*parameter.getHeatjumin();
                }else {
                    caiNuanFei = (Float.parseFloat(thisMonthHis.getHeatDegree()) - Float.parseFloat(lastMonthHis.getHeatDegree()))*parameter.getHeatfeijumin();
                }
                float temp = (Float.parseFloat(thisMonthHis.getGongShuiFlow()) - Float.parseFloat(lastMonthHis.getGongShuiFlow())) - (Float.parseFloat(thisMonthHis.getHuiShuiFlow()) - Float.parseFloat(lastMonthHis.getHuiShuiFlow()));
                if(temp >= 0) {
                    reShuiFei = temp * parameter.getHeatguding();
                }else {
                    reShuiFei = 0;
                }
                yingJiaoFeiYong = caiNuanFei + reShuiFei;
            }else {
                TbSteamKhHis thisMonthHis = new TbSteamKhHis();
                TbSteamKhHis lastMonthHis = new TbSteamKhHis();
                thisMonthHis = Dao.getMonthSteamKhHis(uid, thisyear, thismonth);
                lastMonthHis = Dao.getMonthSteamKhHis(uid, lastyear, lastmonth);
                if(yongHuXingZhi.getSelectedIndex() == 0) {
                    yingJiaoFeiYong = (Float.parseFloat(thisMonthHis.getHeatDegree()) - Float.parseFloat(lastMonthHis.getHeatDegree())) * parameter.getSteamjumin();
                }else {
                    yingJiaoFeiYong = (Float.parseFloat(thisMonthHis.getHeatDegree()) - Float.parseFloat(lastMonthHis.getHeatDegree())) * parameter.getSteamfeijumin();
                }
            }
            feiYong.setText(yingJiaoFeiYong + "");
        }
    }



出错信息:
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
    at sun.misc.FloatingDecimal.readJavaFormatString(Unknown Source)
    at java.lang.Float.parseFloat(Unknown Source)
    at internalFrame.shuRuGuanLi.HeatShuRuPanel$CalculateButtonActionListener.actionPerformed(HeatShuRuPanel.java:278)
    at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
    at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
    at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
    at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
    at java.(Unknown Source)
    at javax.swing.JComponent.processMouseEvent(Unknown Source)
    at java.(Unknown Source)
    at java.awt.Container.processEvent(Unknown Source)
    at java.(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.(Unknown Source)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Window.dispatchEventImpl(Unknown Source)
    at java.(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)

请问下为什么出现这种错误
搜索更多相关主题的帖子: java lang 
2010-09-27 09:18
快速回复:"AWT-EventQueue-0" java.lang.NullPointerException 错误
数据加载中...
 
   



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

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