我用JBUILDER运行下列代码。。出了点错误提示,请高手帮帮忙~~~
package exceptionsample;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;/**
 * <p>Title:ExceptionSample </p>
 * <p>Description: </p>
 * <p>Copyright: Copyright (c) 2005</p>
 * <p>Company: </p>
 * @author not attributable
 * @version 1.0
 */public class ExceptionSample extends JFrame implements Runnable{
  private JButton btnsleep = null;
  private JButton btnwakeup = null;
  private JTextArea ta = null;
  private final static  String newline = "\n";
  private Thread threadone = null;
  public ExceptionSample(){
    super("Exception Sample");
    JToolBar toolbar = new JToolBar();
    toolbar.setFloatable(false);
    btnsleep = new JButton("sleep");
    btnsleep.addActionListener(new ActionListener(){
    public void actionPerformed(ActionEvent evt){
      ta.append("Thread one is sleeping."+newline);
      threadone.start();
    }
    });
    toolbar.add(btnsleep);
    btnwakeup = new JButton("wake up");
    btnwakeup.addActionListener(new ActionListener(){
     public void actionPerformed(ActionEvent evt){
       threadone.interrupt();
     }
    });
    toolbar.add(btnwakeup);
    this.getContentPane().add(toolbar,BorderLayout.NORTH);
    ta = new JTextArea();
    this.getContentPane().add(ta,BorderLayout.CENTER);
    threadone = new Thread(this);
    ta.append("Thread one is produced."+newline);
    this.pack();
    this.setSize(new Dimension(300,200));
    this.show();
  }
  public void tun(){
    try {
      threadone.sleep(1000000);
       }catch(InterruptedException e){
         ta.append("InterruptedException is thrown out."+newline);
         ta.append("Thread one is waken up."+newline);
       }
  }
public static void  main(String args[]){
    ExceptionSample mframe = new ExceptionSample();
    mframe.addWindowListener(new WindowAdapter(){
      public void windowClosing(WindowEvent e){System.exit(0);}
    });
  }
}

解决方案 »

  1.   


    不是。。改了还是不行~~~我打错了。。sorry
      

  2.   

    "exceptionsample.java": Duplicate definition of class exceptionsample.ExceptionSample, defined in C:\Documents and Settings\Administrator\jbproject\ExceptionSample\src\exceptionsample\exceptionsample.java and also defined in C:\Documents and Settings\Administrator\jbproject\ExceptionSample\src\exceptionsample\ExceptionSample.java.
    就这个啦。。
    偶是菜鸟,刚刚学。。有问题就提问。。:)