⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 firstapplet.java

📁 内涵了200个适合Java初学者学习的小程序
💻 JAVA
字号:

import java.lang.*;
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
public class FirstApplet extends java.applet.Applet
{
    private Button button1 = null;
    private Label label1 = null;


    public void init()
    {
        try
        {
            super.init();
            setName("AppletTest");
            setLayout(null);
            setSize(400, 240);
            button1 = new java.awt.Button();
            button1.setName("button");
            button1.setBounds(199, 57, 56, 20);
            button1.setLabel("Click me");
            add
                (button1, button1.getName());
                
            label1 = new java.awt.Label();
            label1.setName("label");
            label1.setText("before click");
            this.label1.setForeground(Color.blue);
            label1.setBounds(67, 59, 100, 20);
            add
                (label1, label1.getName());

            //initConnections();
        }
        catch (java.lang.Throwable ivjExc)
        {
            ;//handleException(ivjExc);
        }
    }
    public boolean action(Event e, Object arg)
    {
       if (e.target instanceof  Button)
         label1.setText("after click");
       return true;
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -