jiayuewei
发贴: 2
|
于 2007-08-11 15:13
import javax.swing.*; import java.awt.*; import java.awt.event.*;
public class Button extends JApplet { private static final long serialVersionUID=123456L JButton b1 = new JButton("向左走"); JButton b2 = new JButton("向右走"); public void init() { this.getContentPane(); run(this); this.setVisible(true); }
public void run(JApplet applet) { container(); JFrame frame = new JFrame(); frame.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE); //响应关闭按钮
}
private void container() { Container cp = getContentPane(); cp.setLayout(new FlowLayout()); cp.add(b1); cp.add(b2); } }
|