小编Ace*_*re6的帖子

如何在此代码中阻止NullPointerException?

当我按下STime等于的JOptionPane.showInputDialog窗口上的取消按钮时,如何在此代码中阻止NullPointerException?(它位于'>>'标志)

我的代码:

insertTableF.addActionListener(new ActionListener () { 
    public void actionPerformed(ActionEvent  e)
    {
        int wayPoint1 = 0;
        int wayPoint2 = 0;
        int PassTime = 0;
        Statement statementR;

        if (loggedIn == 1)
        {

            while(passedR ==0) 
            {
                try 
                {
                    if (wayPoint1==0) 
                    {
                        sTagR =JOptionPane.showInputDialog("Please enter the Rhino Tag number:");
                        iTagR = Integer.parseInt(sTagR);
                        wayPoint1 =1;
                    }
                    if (wayPoint2==0) 
                    {
                        sGPSX = JOptionPane.showInputDialog("Please enter the horizontal GPS Grid Numbers(eg.3123):");
                        iGPS = Integer.parseInt(sGPSX);

                        wayPoint2 = 1;
                    }

                    sGPSY = JOptionPane.showInputDialog("Please enter the vertical GPS Grid Letters(eg.XXYY:");
                    while …
Run Code Online (Sandbox Code Playgroud)

java sql database formatting nullpointerexception

0
推荐指数
1
解决办法
1822
查看次数

标签 统计

database ×1

formatting ×1

java ×1

nullpointerexception ×1

sql ×1