2 liwenjiehd liwenjiehd 于 2016.04.08 20:28 提问

标记“}”上有语法错误,在此标记之后应为 else 40C

标记上具有语法错误,错误放置了构造
标记“}”上有语法错误,在此标记之后应为 else

这两个错误求解答如果悬赏不够我还可以再加在线等谢谢了

public void actionPerformed(ActionEvent e) {

    //关 于 系 统
    if(e.getSource()==jmenuitem13)
    {
        aboutsystem sa=new aboutsystem();
        sa.setVisible(true);               
    }

    //入库信息录入
    if(e.getSource()==jmenuitem9)
    {
        input_info ii=new input_info();
        ii.setVisible(true);
    }

    //出库信息录入
    if(e.getSource()==jmenuitem10)
    {
        import_outfo io=new import_outfo();
        io.setVisible(true);
    }
    //货物修改
    if(e.getSource()==jmenuitem16)
    {int i = 0;
    String str=JOptionPane.showInputDialog(this,"请输入编号","提示",JOptionPane.INFORMATION_MESSAGE);
    if(str.length()==0){
        JOptionPane.showMessageDialog(this,"您你没有输入任何信息","提示",JOptionPane.INFORMATION_MESSAGE);
        return;
    }
    Vector<String> vector=new Vector<String>();
    vector=Function.select6_Ggno(str);
    if(vector.size()==0){
        JOptionPane.showMessageDialog(this,"没有您要找的货物","提示",JOptionPane.INFORMATION_MESSAGE);
        return;
    }   
    UpdateGoods ri=new UpdateGoods();

    ri.jtextfield1.setText(vector.get(0).toString());
    ri.jtextfield3.setText(vector.get(1).toString());
    ri.jtextfield2.setText(vector.get(2).toString());
    ri.jcombobox.setSelectedItem(ri.jcombobox.getItemAt(i));
    ri.setVisible(true);

    }
    //仓库扩建
    if(e.getSource()==jmenuitem14)
    {
       StorageKuo sk=new StorageKuo();
       sk.setVisible(true);
    }

     //所有仓库
    if(e.getSource()==jmenuitem15)
    {
        Vector<Vector<String>> vector=new Vector<Vector<String>>();
        Vector<String> tablehead=new Vector<String>();
        tablehead=Function.gettablehead4();
        vector=Function.select15_Storage();
        jtable=mytable.maketable(vector, tablehead);
        jscrollpane2.getViewport().add(jtable);
    }

     //所有货物
    if(e.getSource()==jmenuitem12)
    {
        Vector<Vector<String>> vector=new Vector<Vector<String>>();
        Vector<String> tablehead=new Vector<String>();
        tablehead=Function.gettablehead1();
        vector=Function.select1_Stock();
        jtable=mytable.maketable(vector, tablehead);
        jscrollpane2.getViewport().add(jtable);
    }
    //供应商管理
    //供应商注册
    if(e.getSource()==jmenuitema3)
    {
        AddProvide ap=new AddProvide();
        ap.setVisible(true);
    }
    //供应商查询
    if(e.getSource()==jmenuitema5)
    {
        Vector<Vector<String>> vector=new Vector<Vector<String>>();
        Vector<String> tablehead=new Vector<String>();
        tablehead=Function.gettablehead2();
        vector=Function.select1_Provide();
        jtable=mytable.maketable(vector, tablehead);
        jscrollpane2.getViewport().add(jtable);
    }
    //供应商修改
    if(e.getSource()==jmenuitema4)
    {
        //int i = 0;
        String str=JOptionPane.showInputDialog(this,"请输入编号","提示",JOptionPane.INFORMATION_MESSAGE);
        if(str.length()==0){
            JOptionPane.showMessageDialog(this,"您你没有输入任何信息","提示",JOptionPane.INFORMATION_MESSAGE);
            return;
        }
        Vector<String> vector=new Vector<String>();

        vector=Function.select13_Pno(str);
        if(vector.size()==0){
            JOptionPane.showMessageDialog(this,"没有您要找的供应商","提示",JOptionPane.INFORMATION_MESSAGE);
            return;
        }   
        UpdateProvide ri=new UpdateProvide();

        ri.jtextfield2.setText(vector.get(1).toString());
        ri.jtextfield3.setText(vector.get(2).toString());
        ri.jtextfield4.setText(vector.get(3).toString());
        ri.jtextfield5.setText(vector.get(4).toString());
        ri.jtextfield1.setText(vector.get(0).toString());

        //图片放在显示框中间

        ri.setVisible(true);

        } 


    //供应商注销
    if(e.getSource()==jmenuitema1)
    {
        String str1=JOptionPane.showInputDialog(this, "请输入供应商编号","提示",JOptionPane.INFORMATION_MESSAGE);
         if(str1.length()==0){
             JOptionPane.showMessageDialog(this, "您没有输入任何信息","错误", JOptionPane.ERROR_MESSAGE);
             return;
         }
        Delete.delete1_Pno(str1);
        JOptionPane.showMessageDialog(this,"已经成功注销", "提示", JOptionPane.INFORMATION_MESSAGE);

    }

    //客户管理
    //管理员替客户注册
    if(e.getSource()==jmenuitema12)
    {
        ClienRegistl ap=new ClienRegistl();
        ap.setVisible(true);
    }
    //客户查询
    if(e.getSource()==jmenuitema9)
    {
        Vector<Vector<String>> vector=new Vector<Vector<String>>();
        Vector<String> tablehead=new Vector<String>();
        tablehead=Function.gettablehead3();
        vector=Function.select1_Client();
        jtable=mytable.maketable(vector, tablehead);
        jscrollpane2.getViewport().add(jtable);
    }
    //客户修改
    if(e.getSource()==jmenuitema11)
    {

        String str=JOptionPane.showInputDialog(this,"请输入编号","提示",JOptionPane.INFORMATION_MESSAGE);
        if(str.length()==0){
            JOptionPane.showMessageDialog(this,"您你没有输入任何信息","提示",JOptionPane.INFORMATION_MESSAGE);
            return;
        }
        try {

        Vector<String> vector=new Vector<String>();

        vector=Function.select14_Cno(str);
        if(vector.size()==0){
            JOptionPane.showMessageDialog(this,"没有您要找的客户","提示",JOptionPane.INFORMATION_MESSAGE);
            return;
        }   
        UpdateClient ri=new UpdateClient();

        ri.jtextfield1.setText(vector.get(0).toString().trim());
        ri.jtextfield2.setText(vector.get(1).toString().trim());
        ri.jtextfield3.setText(vector.get(2).toString().trim());
        ri.jtextfield4.setText(vector.get(3).toString().trim());
        //ImageIcon icon=new ImageIcon(vector.get(4).getBytes());
        //ri.jlabel1.setIcon(icon);
        //ri.jlabel1.setHorizontalAlignment(SwingConstants.CENTER);   //图片放在显示框中间

        ri.setVisible(true);

        } catch (Exception e2) {

        System.out.println("yichang:vector.size()");
        System.out.println("\nstr="+str);               
        }
    }
    //客户注销
    if(e.getSource()==jmenuitema10)
    {
        String str1=JOptionPane.showInputDialog(this, "请输入客户编号","提示",JOptionPane.INFORMATION_MESSAGE);
         if(str1.length()==0){
             JOptionPane.showMessageDialog(this, "您没有输入任何信息","错误", JOptionPane.ERROR_MESSAGE);
             return;
         }
        Delete.delete2_Cno(str1);
        JOptionPane.showMessageDialog(this,"已经成功注销", "提示", JOptionPane.INFORMATION_MESSAGE); 
    }



    //按货物编号查询
    if(e.getSource()==jmenuitem5)
    {

        String str1=JOptionPane.showInputDialog(this, "请输入货物编号","提示",JOptionPane.INFORMATION_MESSAGE);
     if(str1.length()==0){
         JOptionPane.showMessageDialog(this, "您没有输入任何信息","错误", JOptionPane.ERROR_MESSAGE);
         return;
     }
     Vector<Vector<String>> vector=new Vector<Vector<String>>();
     Vector<String> tablehead=new Vector<String>();
     tablehead=Function.gettablehead1();
     vector=Function.select7_Gno(str1);
     if(vector.size()==0){
         JOptionPane.showMessageDialog(this,"对不起,货物编号不存在", "提示", JOptionPane.INFORMATION_MESSAGE);
         return;
     }
        Vector<String> vector19=new Vector<String>();
        while(vector.size()<40){
            vector.add(vector19);   
            }
     jtable=mytable.maketable(vector,tablehead);
     jscrollpane2.getViewport().add(jtable);
    }


    //按货物名称查询
    if(e.getSource()==jmenuitem6)
    { 
        String str1=JOptionPane.showInputDialog(this, "请输入货物名称","提示",JOptionPane.INFORMATION_MESSAGE);
     if(str1.length()==0){
         JOptionPane.showMessageDialog(this, "您没有输入任何信息","错误", JOptionPane.ERROR_MESSAGE);
         return;
     }
     Vector<Vector<String>> vector=new Vector<Vector<String>>();
     Vector<String> tablehead=new Vector<String>();
     tablehead=Function.gettablehead1();
     vector=Function.select5_Gname(str1);
     if(vector.size()==0){
         JOptionPane.showMessageDialog(this,"对不起没有您需要的货物", "提示", JOptionPane.INFORMATION_MESSAGE);
         return;
     }
        Vector<String> vector19=new Vector<String>();
        while(vector.size()<40){
            vector.add(vector19);   
            }
     jtable=mytable.maketable(vector,tablehead);
     jscrollpane2.getViewport().add(jtable);
    }


    //按仓库查询
    if(e.getSource()==jmenuitem8)
    {

        String str1=JOptionPane.showInputDialog(this, "请输入仓库编号","提示",JOptionPane.INFORMATION_MESSAGE);
     if(str1.length()==0){
         JOptionPane.showMessageDialog(this, "您没有输入任何信息","错误", JOptionPane.ERROR_MESSAGE);
         return;
     }
     Vector<Vector<String>> vector=new Vector<Vector<String>>();
     Vector<String> tablehead=new Vector<String>();
     tablehead=Function.gettablehead1();
     vector=Function.select8_Sno(str1);
     if(vector.size()==0){
         JOptionPane.showMessageDialog(this,"此仓库号不存在,无法查看仓库库存", "提示", JOptionPane.INFORMATION_MESSAGE);
         return;
     }
        Vector<String> vector19=new Vector<String>();
        while(vector.size()<40){
            vector.add(vector19);   
            }
     jtable=mytable.maketable(vector,tablehead);
     jscrollpane2.getViewport().add(jtable);
    }

5个回答

caozhy
caozhy   Ds   Rxr 2016.04.08 23:49

少了一个}后括号。
至于少在哪里,就很难说了。很可能是最后

caozhy
caozhy   Ds   Rxr 2016.04.08 23:50

public void actionPerformed(ActionEvent e)
{
    //关 于 系 统
    if(e.getSource()==jmenuitem13)
    {
        aboutsystem sa=new aboutsystem();
        sa.setVisible(true);               
    }

    //入库信息录入
    if(e.getSource()==jmenuitem9)
    {
        input_info ii=new input_info();
        ii.setVisible(true);
    }

    //出库信息录入
    if(e.getSource()==jmenuitem10)
    {
        import_outfo io=new import_outfo();
        io.setVisible(true);
    }
    //货物修改
    if(e.getSource()==jmenuitem16)
    {
        int i = 0;
        String str=JOptionPane.showInputDialog(this,"请输入编号","提示",JOptionPane.INFORMATION_MESSAGE);
        if(str.length()==0)
        {
            JOptionPane.showMessageDialog(this,"您你没有输入任何信息","提示",JOptionPane.INFORMATION_MESSAGE);
            return;
        }
        Vector<String> vector=new Vector<String>();
        vector=Function.select6_Ggno(str);
        if(vector.size()==0)
        {
            JOptionPane.showMessageDialog(this,"没有您要找的货物","提示",JOptionPane.INFORMATION_MESSAGE);
            return;
        }   
        UpdateGoods ri=new UpdateGoods();

        ri.jtextfield1.setText(vector.get(0).toString());
        ri.jtextfield3.setText(vector.get(1).toString());
        ri.jtextfield2.setText(vector.get(2).toString());
        ri.jcombobox.setSelectedItem(ri.jcombobox.getItemAt(i));
        ri.setVisible(true);
    }
    //仓库扩建
    if(e.getSource()==jmenuitem14)
    {
        StorageKuo sk=new StorageKuo();
        sk.setVisible(true);
    }

    //所有仓库
    if(e.getSource()==jmenuitem15)
    {
        Vector<Vector<String>> vector=new Vector<Vector<String>>();
        Vector<String> tablehead=new Vector<String>();
        tablehead=Function.gettablehead4();
        vector=Function.select15_Storage();
        jtable=mytable.maketable(vector, tablehead);
        jscrollpane2.getViewport().add(jtable);
    }

    //所有货物
    if(e.getSource()==jmenuitem12)
    {
        Vector<Vector<String>> vector=new Vector<Vector<String>>();
        Vector<String> tablehead=new Vector<String>();
        tablehead=Function.gettablehead1();
        vector=Function.select1_Stock();
        jtable=mytable.maketable(vector, tablehead);
        jscrollpane2.getViewport().add(jtable);
    }
    //供应商管理
    //供应商注册
    if(e.getSource()==jmenuitema3)
    {
        AddProvide ap=new AddProvide();
        ap.setVisible(true);
    }
    //供应商查询
    if(e.getSource()==jmenuitema5)
    {
        Vector<Vector<String>> vector=new Vector<Vector<String>>();
        Vector<String> tablehead=new Vector<String>();
        tablehead=Function.gettablehead2();
        vector=Function.select1_Provide();
        jtable=mytable.maketable(vector, tablehead);
        jscrollpane2.getViewport().add(jtable);
    }
    //供应商修改
    if(e.getSource()==jmenuitema4)
    {
        //int i = 0;
        String str=JOptionPane.showInputDialog(this,"请输入编号","提示",JOptionPane.INFORMATION_MESSAGE);
        if(str.length()==0)
        {
            JOptionPane.showMessageDialog(this,"您你没有输入任何信息","提示",JOptionPane.INFORMATION_MESSAGE);
            return;
        }
        Vector<String> vector=new Vector<String>();

        vector=Function.select13_Pno(str);
        if(vector.size()==0)
        {
            JOptionPane.showMessageDialog(this,"没有您要找的供应商","提示",JOptionPane.INFORMATION_MESSAGE);
            return;
        }   
        UpdateProvide ri=new UpdateProvide();

        ri.jtextfield2.setText(vector.get(1).toString());
        ri.jtextfield3.setText(vector.get(2).toString());
        ri.jtextfield4.setText(vector.get(3).toString());
        ri.jtextfield5.setText(vector.get(4).toString());
        ri.jtextfield1.setText(vector.get(0).toString());

        //图片放在显示框中间

        ri.setVisible(true);

    } 


    //供应商注销
    if(e.getSource()==jmenuitema1)
    {
        String str1=JOptionPane.showInputDialog(this, "请输入供应商编号","提示",JOptionPane.INFORMATION_MESSAGE);
        if(str1.length()==0)
        {
            JOptionPane.showMessageDialog(this, "您没有输入任何信息","错误", JOptionPane.ERROR_MESSAGE);
            return;
        }
        Delete.delete1_Pno(str1);
        JOptionPane.showMessageDialog(this,"已经成功注销", "提示", JOptionPane.INFORMATION_MESSAGE);

    }

    //客户管理
    //管理员替客户注册
    if(e.getSource()==jmenuitema12)
    {
        ClienRegistl ap=new ClienRegistl();
        ap.setVisible(true);
    }
    //客户查询
    if(e.getSource()==jmenuitema9)
    {
        Vector<Vector<String>> vector=new Vector<Vector<String>>();
        Vector<String> tablehead=new Vector<String>();
        tablehead=Function.gettablehead3();
        vector=Function.select1_Client();
        jtable=mytable.maketable(vector, tablehead);
        jscrollpane2.getViewport().add(jtable);
    }
    //客户修改
    if(e.getSource()==jmenuitema11)
    {

        String str=JOptionPane.showInputDialog(this,"请输入编号","提示",JOptionPane.INFORMATION_MESSAGE);
        if(str.length()==0)
        {
            JOptionPane.showMessageDialog(this,"您你没有输入任何信息","提示",JOptionPane.INFORMATION_MESSAGE);
            return;
        }
        try 
        {

            Vector<String> vector=new Vector<String>();

            vector=Function.select14_Cno(str);
            if(vector.size()==0)
            {
                JOptionPane.showMessageDialog(this,"没有您要找的客户","提示",JOptionPane.INFORMATION_MESSAGE);
                return;
            }   
            UpdateClient ri=new UpdateClient();

            ri.jtextfield1.setText(vector.get(0).toString().trim());
            ri.jtextfield2.setText(vector.get(1).toString().trim());
            ri.jtextfield3.setText(vector.get(2).toString().trim());
            ri.jtextfield4.setText(vector.get(3).toString().trim());
            //ImageIcon icon=new ImageIcon(vector.get(4).getBytes());
            //ri.jlabel1.setIcon(icon);
            //ri.jlabel1.setHorizontalAlignment(SwingConstants.CENTER);   //图片放在显示框中间

            ri.setVisible(true);

        } 
        catch (Exception e2)
        {

            System.out.println("yichang:vector.size()");
            System.out.println("\nstr="+str);               
        }
    }
    //客户注销
    if(e.getSource()==jmenuitema10)
    {
        String str1=JOptionPane.showInputDialog(this, "请输入客户编号","提示",JOptionPane.INFORMATION_MESSAGE);
        if(str1.length()==0)
        {
            JOptionPane.showMessageDialog(this, "您没有输入任何信息","错误", JOptionPane.ERROR_MESSAGE);
            return;
        }
        Delete.delete2_Cno(str1);
        JOptionPane.showMessageDialog(this,"已经成功注销", "提示", JOptionPane.INFORMATION_MESSAGE); 
    }



    //按货物编号查询
    if(e.getSource()==jmenuitem5)
    {

        String str1=JOptionPane.showInputDialog(this, "请输入货物编号","提示",JOptionPane.INFORMATION_MESSAGE);
        if(str1.length()==0)
        {
            JOptionPane.showMessageDialog(this, "您没有输入任何信息","错误", JOptionPane.ERROR_MESSAGE);
            return;
        }
        Vector<Vector<String>> vector=new Vector<Vector<String>>();
        Vector<String> tablehead=new Vector<String>();
        tablehead=Function.gettablehead1();
        vector=Function.select7_Gno(str1);
        if(vector.size()==0)
        {
            JOptionPane.showMessageDialog(this,"对不起,货物编号不存在", "提示", JOptionPane.INFORMATION_MESSAGE);
            return;
        }
        Vector<String> vector19=new Vector<String>();
        while(vector.size()<40)
        {
            vector.add(vector19);   
        }
        jtable=mytable.maketable(vector,tablehead);
        jscrollpane2.getViewport().add(jtable);
    }


    //按货物名称查询
    if(e.getSource()==jmenuitem6)
    { 
        String str1=JOptionPane.showInputDialog(this, "请输入货物名称","提示",JOptionPane.INFORMATION_MESSAGE);
        if(str1.length()==0)
        {
            JOptionPane.showMessageDialog(this, "您没有输入任何信息","错误", JOptionPane.ERROR_MESSAGE);
            return;
        }
        Vector<Vector<String>> vector=new Vector<Vector<String>>();
        Vector<String> tablehead=new Vector<String>();
        tablehead=Function.gettablehead1();
        vector=Function.select5_Gname(str1);
        if(vector.size()==0)
        {
            JOptionPane.showMessageDialog(this,"对不起没有您需要的货物", "提示", JOptionPane.INFORMATION_MESSAGE);
            return;
        }
        Vector<String> vector19=new Vector<String>();
        while(vector.size()<40)
        {
            vector.add(vector19);   
        }
        jtable=mytable.maketable(vector,tablehead);
        jscrollpane2.getViewport().add(jtable);
    }


    //按仓库查询
    if(e.getSource()==jmenuitem8)
    {

        String str1=JOptionPane.showInputDialog(this, "请输入仓库编号","提示",JOptionPane.INFORMATION_MESSAGE);
        if(str1.length()==0)
        {
            JOptionPane.showMessageDialog(this, "您没有输入任何信息","错误", JOptionPane.ERROR_MESSAGE);
            return;
        }
        Vector<Vector<String>> vector=new Vector<Vector<String>>();
        Vector<String> tablehead=new Vector<String>();
        tablehead=Function.gettablehead1();
        vector=Function.select8_Sno(str1);
        if(vector.size()==0)
        {
            JOptionPane.showMessageDialog(this,"此仓库号不存在,无法查看仓库库存", "提示", JOptionPane.INFORMATION_MESSAGE);
            return;
        }
        Vector<String> vector19=new Vector<String>();
        while(vector.size()<40)
        {
            vector.add(vector19);   
        }
        jtable=mytable.maketable(vector,tablehead);
        jscrollpane2.getViewport().add(jtable);
    }
//可能少在这里
Crystal_Plum9
Crystal_Plum9   2016.04.09 12:00

代码要规范,出现错了,也一目了然!

zanfeng
zanfeng   2016.04.09 12:36

从最后一个加}
不行再往上加。

u013836857
u013836857   2016.04.08 22:52

你应该用if(...){....}else if(...){.....}做判断。这样更清晰明了,也没那么容易出错

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!