输入超过五个字就会报异常,该怎么解决
  1. import java.awt.*;
    import javax.swing.*;
    import java.sql.*;
    import java.awt.event.*;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.SQLException;
    import java.sql.Statement;
    import java.util.regex.*;
    import java.util.Random;
    import static java.awt.BorderLayout.*;
    import java.io.File;
    import java.io.IOException;
    import javax.sound.sampled.AudioFormat;
    import javax.sound.sampled.AudioInputStream;
    import javax.sound.sampled.AudioSystem;
    import javax.sound.sampled.DataLine;
    import javax.sound.sampled.LineUnavailableException;
    import javax.sound.sampled.SourceDataLine;
    import javax.sound.sampled.UnsupportedAudioFileException;
    public class RobotDemo
    {
    final JTextArea jta=new JTextArea(30,40);
    final JTextField jtf=new JTextField(10);
    final JTextField jtf1=new JTextField(10);
    final JTextField jtf2=new JTextField(10);
    Link lk,lk1,lk2,lk3,lk4,lk5;
    ResultSet rs ,rs1,rs2,rs3,rs4,rs5;
    Statement sta;
    String answer,res;
    Random r=new Random();
    public void init()
    {
    final JFrame jf=new JFrame();
    JPanel jp=new JPanel();
    JPanel jp1=new JPanel();
    JPanel jp2=new JPanel();
    JButton jb=new JButton("发送");
    JButton jb1=new JButton("训练");
    JButton jb2=new JButton("确定");
    JButton jb3=new JButton("再加一条");
    final JDialog jd=new JDialog(jf,"训练");
    final JDialog jd1=new JDialog(jf,"提示信息");
    JTextArea jta1=new JTextArea(5,10);
    jd1.setLayout(new BorderLayout());
    jd1.add(jta1,NORTH);
    JPanel jp3=new JPanel();
    jd1.add(jp3,SOUTH);
    jp3.setLayout(new FlowLayout(FlowLayout.RIGHT));
    JButton jb4=new JButton("确定");
    jp3.add(jb4);
    jta1.setText("不能发送空白内容");

    jf.add(jp);
    jp.setLayout(new BorderLayout());
    jp.add(jta,NORTH);
    jp.add(jp1,SOUTH);
    jp1.add(jtf);
    jp1.add(jb);
    jp1.add(jb1);
    jd.add(jp2);
    jp2.add(jtf1);
    jp2.add(jtf2);
    jp2.add(jb3);
    jp2.add(jb2);
    jb4.addActionListener(new ActionListener()
    {
    public void actionPerformed(ActionEvent e)
    {
    jd1.setVisible(false);
    jta.setText("");

        }
    });
    jb.addActionListener(new ActionListener()
    {
        public void actionPerformed(ActionEvent e)
        {
            String out="";
            String result="";
            String s=jtf.getText();
            if(s.equals(""))
            {
                jd1.pack();
                jd1.setVisible(true);
            }
            if(s.length()<4)
            {
                result=find(s);
            }
            else
            {
                result=find1(s);
            }
            out="我:"+s+"\n"+"机器人:"+result+"\n";
            jta.setText(out);
            jtf.setText("");
    
        }
    });
    jb2.addActionListener(new ActionListener()
    {
        public void actionPerformed(ActionEvent e)
        {
    
            String question =jtf1.getText();
            String answer=jtf2.getText();
            try
            {
                if(question.equals("")&&answer.equals(""))
                {
                    JOptionPane.showMessageDialog(null, "不能添加空白内容");
                }
                else
                {
                Statement sta = null;
                String sql="insert into chat1 values('" +question+ "','" +answer+"')";
                lk=new Link(sql);
                lk.sta.executeUpdate(sql);
                JOptionPane.showMessageDialog(null, "添加成功");
                }
    
            }
            catch(Exception a)
            {
                a.printStackTrace();
                JOptionPane.showMessageDialog(null, "添加失败");
            }
            finally
            {
                lk.closeConn();
            }
        }
    });
    jb3.addActionListener(new ActionListener()
    {
        public void actionPerformed(ActionEvent e)
        {
            jtf2.setText("");
        }
    });
    jb1.addActionListener(new ActionListener()
    {
        public void actionPerformed(ActionEvent e)
        {
            jd.pack();
            jd.setVisible(true);
        }
    });
    jf.pack();
    jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    jf.setVisible(true);
    

    }
    public String find(String s)
    {
    String result="";

        try
        {
            String sql="select *from chat1";
            lk=new Link(sql);
            rs=lk.sta.executeQuery(sql);
            while(rs.next())
            {
                String string =new String(rs.getString("question"));
                if(string.equals(s)||string.contains(s)||s.contains(string))
                {
                    try
                    {
                        String sql1="select * from chat1 where question='"+string+"'";
                        lk1=new Link(sql1);
                        rs1=lk1.sta.executeQuery(sql1);
                        while(rs1.next())
                        {
                            result=new String (rs1.getString("answer"));
                        }
    
                    }
                    catch(Exception e)
                    {
                        e.printStackTrace();
                    }
                    finally
                    {
                        lk1.closeConn();
                    }
                }
            }
        }
        catch(Exception e)
        {
            e.printStackTrace();
        }
        finally
        {
            lk.closeConn();
        }
        if(result.equals(""))
        {
            int i=3;
            int k=r.nextInt(i);
            if(k==0)
                result="asdfsdaf";
            else if(k==1)
                result="rtfdsg";
            else if(k==2)
                result="fgasdd";
        }
        return result;
    

    }
    public String find1(String s){
    Boolean flag=false;
    char c[];
    int j=0,m=0,max=0;
    String result=null,ans="";
    String string[]=new String[20];
    String regex="[a-zA-Z0-9,。、;‘【】、=-《》?:的“{}——+|) _(*&……%¥#@!~·哦他她你我了吗嘛呢吧 ]";
    Pattern p1=Pattern.compile(regex);
    Matcher m1=p1.matcher(s);
    ans=m1.replaceAll("").trim();
    c=new char[ans.length()];
    for(int i=0;i<ans.length();i++){
    c[i]=ans.charAt(i);
    }

        for(j=0;j<c.length-1;j++){
            if(j==0){
    
                try{
                    String sql="drop table if exists possible";
                    lk=new Link(sql);
                    lk.sta.executeUpdate(sql);
                    String sql1="create  table possible(question varchar(60))";
                    lk1=new Link(sql1);
                    lk1.sta.executeUpdate(sql1);
                }catch(Exception e){
                    e.printStackTrace();
                    }
                finally{
                    lk1.closeConn();
                    lk.closeConn();
                    }
            }                   
            try{
                String sql2="select *from chat1";
                lk2=new Link(sql2);
                rs2=lk2.sta.executeQuery(sql2);
                while(rs2.next()){
                    int i=0;
                    String str=new String (rs2.getString("question"));
                    do{
                        flag=false;
                        int k=i+1;
                        int ij=i+j;
                        if(ij<c.length){
                        char c1=str.charAt(i);
    
                            if(c[ij]==c1&&str.length()==k){
                                String sql3="insert into possible values('"+str+"')";
                                lk3=new Link(sql3);
                                lk3.sta.executeUpdate(sql3);
                            }
                            else if(c[ij]==c1&&str.length()!=k){
                                flag=true;
                                i++;
                                }
                            }
                        }while(flag);
                    }
                }catch(Exception e2){
                    e2.printStackTrace();
                    }
                finally{
                    lk2.closeConn();
                    if(lk3!=null){
                    lk3.closeConn();
                        }
                    }
        }
        try{
            String sql4="select *from possible";
            lk4=new Link(sql4);
            rs4=lk4.sta.executeQuery(sql4);
            while(rs4.next()){
                string[m]=new String(rs4.getString("question"));
                m++;
                }
            if(m!=0){
                max=string[0].length();
                ans=string[0];
                for(int k=1;k<=m;k++){
                    if(max<string[k-1].length()){
                        ans=string[k-1];
                        max=string[k-1].length();
                            }
                    }
    
                    String sql5="select *from chat1 where question='"+ans+"'";
                    lk5=new Link(sql5);
                    rs5=lk5.sta.executeQuery(sql5);
                    while(rs5.next()){
                         ans=new String(rs5.getString("answer"));
                        }
            }
            else{
                int i=4;
                int k=r.nextInt(i);
                if(k==0){
                    result="rd6dfg";
                }else if(k==1){
                    result="8ujhgjghg";
                }else if(k==2){
                    result="dftyghf";
                }
            }
        }catch(Exception ea){
            ea.printStackTrace();
            }
        finally{
            lk4.closeConn();
            if(lk5!=null){
                lk5.closeConn();
            }
        }
        if(result.equals("")){
            result="tfyrtyrt";
            }
    return result;
    

    }
    public static void main(String[] args)
    {
    new RobotDemo().init();
    String MUSIC_FILE="相逢一笑.wav";
    try
    {
    AudioInputStream audioInputStream= AudioSystem.getAudioInputStream(new File(MUSIC_FILE));
    AudioFormat audioFormat=audioInputStream.getFormat();
    DataLine.Info dataLineInfo=new DataLine.Info(SourceDataLine.class,audioFormat,AudioSystem.NOT_SPECIFIED);
    SourceDataLine sourceDataLine=(SourceDataLine)AudioSystem.getLine(dataLineInfo);
    sourceDataLine.open(audioFormat);
    sourceDataLine.start();
    int count;
    byte tempBuffer[]=new byte[1024];
    while ((count = audioInputStream.read(tempBuffer, 0,
    tempBuffer.length)) != -1)
    {
    if(count>0)
    {
    sourceDataLine.write(tempBuffer,0,count);
    }
    }
    sourceDataLine.drain();
    sourceDataLine.close();
    }
    catch(Exception a)
    {
    a.printStackTrace();
    }

    }

}

3个回答

java.lang.StringIndexOutOfBoundsException: String index out of range: 0
at java.lang.String.charAt(Unknown Source)
at RobotDemo.find1(RobotDemo.java:256)
at RobotDemo$2.actionPerformed(RobotDemo.java:92)
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.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(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.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$200(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(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.StringIndexOutOfBoundsException: String index out of range: 0
at java.lang.String.charAt(Unknown Source)
at RobotDemo.find1(RobotDemo.java:256)
at RobotDemo$2.actionPerformed(RobotDemo.java:92)
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.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(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.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$200(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(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)
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at RobotDemo.find1(RobotDemo.java:325)
at RobotDemo$2.actionPerformed(RobotDemo.java:92)
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.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(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.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$200(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(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.StringIndexOutOfBoundsException: String index out of range: 0
at java.lang.String.charAt(Unknown Source)
at RobotDemo.find1(RobotDemo.java:256)
at RobotDemo$2.actionPerformed(RobotDemo.java:92)
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.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(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.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$200(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(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.StringIndexOutOfBoundsException: String index out of range: 0
at java.lang.String.charAt(Unknown Source)
at RobotDemo.find1(RobotDemo.java:256)
at RobotDemo$2.actionPerformed(RobotDemo.java:92)
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.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(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.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$200(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(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)
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at RobotDemo.find1(RobotDemo.java:325)
at RobotDemo$2.actionPerformed(RobotDemo.java:92)
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.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(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.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$200(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(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)

把异常信息贴出来,看看是什么异常,出现在哪行

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!

相似问题

3
Qt5 中窗口全屏状态下,ComboBox的下拉框无法显示?以及文本输入框输入文字时无法切换输入法?
2
C#语言,输入10个数字,去掉一个最大值,一个最小值,求剩下的平均数
6
从键盘输入一个数字(不限位数),用循环语句编程判断并输出这个数字的位数
5
readUTF()使用报 java.io.EOFException异常
1
VB6.0中如何用inputbox函数实现输入10个数字,求最大的哪一个?
1
怎么先序建立一颗二叉树,输入一个数字比如12,生成12个节点的二叉树,
4
连续输入5个账号,不允许输入重复的,如果输入相同报错,该怎么实现?
4
需要一个php信息输入页面和一个html显示页面
2
myeclipse 控制台输入中文异常
4
怎么解决输入-1时被当做EOF问题
2
文本框输入文字,标题栏自动变成“正在输入
1
CNN神经网络数字识别样本该如何输入?
4
android怎么验证输入框中的内容是汉字,或者邮箱,数字和字母等?
1
ubuntu系统键盘输入出现异常
3
怎么用语音报警的方式提醒用户输入错误?
3
对话框中10个文本框,在文本框中输入2个数字后,自动开始输入下一个文本框
1
js中判断只能输入7位当数字达到指定长度后只能输入两位小数
5
java异常捕获问题,从命令行输入数据
2
java爬虫求助,为什么报异常了,怎么解决
2
用C语言写的程序,目标是输入一个字母,输出这个字母其后的第四个,下面程序有点问题,求帮看看。