请给个示例,考究起来快些.多谢.
请给个示例,考究起来快些.多谢.
jframe.add(applet);
import java.awt.*;
import java.awt.event.*;
import java.net.*;
import java.applet.*;
import javax.swing.*;/**
* A very simple applet.
*/
public class SwingApplet extends JApplet {JButton button;
public void init(){
getContentPane().setLayout(new FlowLayout());
button = new JButton(\"Hello, I'm a Swing Button!\");
getContentPane().add(button);
}
public static void main(String[] args){
JFrame frame =new JFrame(\"JFrame&JApplet\");
JApplet applet =new SwingApplet();
frame.getContentPane().add(applet); //这样楼主的JDK就可以编译通过了,楼主的JDK还是1.5以前的.还是下载个JDK1.6用用吧~:)
applet.init();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(320,240);
frame.setVisible(true);
}
}
[此贴子已经被作者于2007-2-8 16:40:25编辑过]
直持此说法.