搜索
首页 电脑/网络 程序设计 JAVA相关

请编写一个Applet

请编写一个Applet,在其窗口中摆放一个按钮和一个标签,当点击按钮时在标签上显示“按钮被点击”。2、请编写一个Applet,在其窗口中摆放一个按钮和一个标签,当点击按钮时在标签上显示“按钮被点击”。

全部回答

2005-12-20

0 0
     import t。*; import t。event。*; import java。applet。*; import javax。swing。*; public class Applet1 extends Applet { private boolean isStandalone = false; JButton jButton1 = new JButton(); JLabel jLabel1 = new JLabel(); public String getParameter(String key, String def) { return isStandalone ? tProperty(key, def) : (getParameter(key) != null ? getParameter(key) : def); } //Construct the applet public Applet1() { } //Initialize the applet public void init() { try { jbInit(); } catch(Exception e) { intStackTrace(); } } //Component initialization private void jbInit() throws Exception { tBounds(new Rectangle(100, 177, 82, 29)); tText("显示"); dActionListener(new Applet1_jButton1_actionAdapter(this)); tLayout(null); tText(" "); tBounds(new Rectangle(69, 85, 147, 44)); d(jButton1, null); d(jLabel1, null); } //Get Applet information public String getAppletInfo() { return "Applet Information"; } //Get parameter info public String[][] getParameterInfo() { return null; } void jButton1_actionPerformed(ActionEvent e) { tText("按钮被点击"); } } class Applet1_jButton1_actionAdapter implements t。
    event。ActionListener { Applet1 adaptee; Applet1_jButton1_actionAdapter(Applet1 adaptee) { aptee = adaptee; } public void actionPerformed(ActionEvent e) { adaptee。
    jButton1_actionPerformed(e); } }。

类似问题换一批

热点推荐

热度TOP

相关推荐
加载中...

热点搜索 换一换

电脑/网络
JAVA相关
硬件
电脑装机
程序设计
互联网
操作系统/系统故障
笔记本电脑
反病毒
百度
软件
程序设计
JAVA相关
VB
数据库
C/C++
汇编语言
VC++
C#/.NET
其他编程语言
JAVA相关
JAVA相关
举报
举报原因(必选):
取消确定举报