import java.awt.*;
import javax.swing.*;

解决方案 »

  1.   

    源代码如下package testhello;import javax.swing.*;
    import java.awt.event.*;
    /**
     * <p>Title: </p>
     * <p>Description: </p>
     * <p>Copyright: Copyright (c) 2003</p>
     * <p>Company: </p>
     * @author unascribed
     * @version 1.0
     */public class test extends JComponent {
      private JButton jButton1 = new JButton();  public test() {
        try {
          jbInit();
        }
        catch(Exception e) {
          e.printStackTrace();
        }
      }
      public static void main(String[] args) {
        test test1 = new test();
      }
      private void jbInit() throws Exception {
        jButton1.setBounds(new Rectangle(173, 209, 79, 29));
        jButton1.setText("jButton1");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            jButton1_actionPerformed(e);
          }
        });
        this.add(jButton1, null);
      }  void jButton1_actionPerformed(ActionEvent e) {  }
    }