错误:'{'预期此错误是什么意思? [英] error: '{' expected What does this error mean?

查看:1525
本文介绍了错误:'{'预期此错误是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这就是错误的样子



This is what the error looks like

pledgeform2.java:8: error: '{' expected
public class Pledgeform2.java extends javax.swing.JFrame
                        ^
1 error









我一直收到错误消息指示第8行的'{'预期为粗体。我一直在试图找出错误的内容和位置。请帮助!!!







I keep getting an error message indicating '{' expected on line 8 in bold. I have been trying to figure out what and where the error is. Please help!!!

package Pledgeform.java;
import javax.swing.JFrame;
import javax.swing.*;
public class Pledgeform2.java extends javax.swing.JFrame	
	public Pledgeform2() {
        initComponents();
    };    
    JFrame guiFrame = new JFrame();
    JPanel panel_1;
    JLabel label_1;
    JLabel label_2;
    ButtonGroup cbg;
    JRadioButton radio_1;
    JRadioButton radio_2;
    JRadioButton radio_3;
    JRadioButton radio_4;
    JList list_1;
    JScrollPane sp_list_1;
    JLabel label_3;
	 
    public static void main(String args[]) {
    
    }
    public Pledgeform2() {
        Pledgeform2Layout customLayout = new Pledgeform2Layout();
        panel_1 = new JPanel();    
        label_1 = new JLabel("Last Name");
        label_2 = new JLabel("First Name");
        cbg = new ButtonGroup();
        radio_1 = new JRadioButton("$10.00", false);
        cbg.add(radio_1);
        radio_2 = new JRadioButton("$20.00", false);
        cbg.add(radio_2);
        radio_3 = new JRadioButton("$50.00", false);
        cbg.add(radio_3);
        radio_4 = new JRadioButton("Other Amount", false);
        cbg.add(radio_4);       
        DefaultListModel listModel_list_1 = new DefaultListModel();
        listModel_list_1.addElement("Red Cross");
        listModel_list_1.addElement("Salvation Army");
        listModel_list_1.addElement("Humane Society");
        listModel_list_1.addElement("Poor UofP Students");
        list_1 = new JList(listModel_list_1);
        sp_list_1 = new JScrollPane(list_1);
        label_3 = new JLabel("Call 1-800-555-6789 if pledging other amount");
        /**
         * @param args the command line arguments
         */
    }
}

推荐答案

10.00,false);
cbg.add(radio_1);
radio_2 = new JRadioButton(
10.00", false); cbg.add(radio_1); radio_2 = new JRadioButton("


20.00,false);
cbg.add(radio_2);
radio_3 = new JRadioButton(
20.00", false); cbg.add(radio_2); radio_3 = new JRadioButton("


50.00,false);
cbg.add(radio_3);
radio_4 = new JRadioButton( 其他金额,false);
cbg.add(radio_4);
DefaultListModel listModel_list_1 = new DefaultListModel();
listModel_list_1.addElement( Red Cross);
listModel_list_1.addElement( 救世军);
listModel_list_1.addElement( Humane Society);
listModel_list_1.addElement( 贫困的UofP学生);
list_1 = new JList(listModel_list_1);
sp_list_1 = new JScrollPane(list_1);
label_3 = new JLabel( Call 1 -800-555-6789如果承诺其他金额);
/ * *
* @param args命令行参数
* /

}
}
50.00", false); cbg.add(radio_3); radio_4 = new JRadioButton("Other Amount", false); cbg.add(radio_4); DefaultListModel listModel_list_1 = new DefaultListModel(); listModel_list_1.addElement("Red Cross"); listModel_list_1.addElement("Salvation Army"); listModel_list_1.addElement("Humane Society"); listModel_list_1.addElement("Poor UofP Students"); list_1 = new JList(listModel_list_1); sp_list_1 = new JScrollPane(list_1); label_3 = new JLabel("Call 1-800-555-6789 if pledging other amount"); /** * @param args the command line arguments */ } }


这篇关于错误:'{'预期此错误是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆