sxjy
发贴: 17
积分: 0
|
于 2004-12-03 07:18
我用Freejava调试了这个程序,怎么出现下面三个错误? import javax.swing.*; import java.awt.*; import java.awt.event.*;
public class FrameDempl { public static void main(String args[]) { Jframe frame=new Jframe("Exam10.1"); Container c=frame.getContentPane(); c.setLayout(new FlowLayoutDemo()); Jlabel 1b=new JLabel("FrameDemo"); JTextField tf=new JTextField("TextField"); JButton bt1=new JButton("Button"); JButton bt2=new JButton("Button"); c.add(1b); c.add(tf); c.add(bt1); c.add(bt2); frame.setSize(400,100); frame.show(); frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); } }
编译后:
FrameDempl.java:12: not a statement Jlabel 1b=new JLabel("FrameDemo"); ^ FrameDempl.java:12: ';' expected Jlabel 1b=new JLabel("FrameDemo"); ^ FrameDempl.java:16: ')' expected c.add(1b); ^ 3 errors Exit code: 1 There were errors
littledeer1974 edited on 2004-12-08 08:20
|