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

📄 applettest.java

📁 东软JAVA内部资料
💻 JAVA
字号:
package org.course.gui;import java.awt.*;import java.awt.event.*;import java.applet.*;import javax.swing.*;/** * <p>Title: </p> * <p>Description: </p> * <p>Copyright: Copyright (c) 2003</p> * <p>Company: </p> * @author not attributable * @version 1.0 */public class AppletTest extends Applet {  private boolean isStandalone = false;  BorderLayout borderLayout1 = new BorderLayout();  Label label1 = new Label();  TextArea textArea1 = new TextArea();  Panel panel1 = new Panel();  Button button1 = new Button();  Button button2 = new Button();  //Get a parameter value  public String getParameter(String key, String def) {    return isStandalone ? System.getProperty(key, def) :      (getParameter(key) != null ? getParameter(key) : def);  }  //Construct the applet  public AppletTest() {  }  //Initialize the applet  public void init() {    try {      jbInit();    }    catch(Exception e) {      e.printStackTrace();    }  }  //Component initialization  private void jbInit() throws Exception {    label1.setAlignment(Label.CENTER);    label1.setLocale(java.util.Locale.getDefault());    label1.setText("这是一个Applet");    this.setLayout(borderLayout1);    textArea1.setText("在这里输入");    button1.setLabel("确定");    button1.addActionListener(new AppletTest_button1_actionAdapter(this));    button2.setLabel("取消");    this.add(label1, BorderLayout.NORTH);    this.add(textArea1, BorderLayout.CENTER);    this.add(panel1,  BorderLayout.SOUTH);    panel1.add(button1, null);    panel1.add(button2, null);  }  //Get Applet information  public String getAppletInfo() {    return "Applet Information";  }  //Get parameter info  public String[][] getParameterInfo() {    return null;  }  void button1_actionPerformed(ActionEvent e) {    String hello=textArea1.getText();    JOptionPane.showMessageDialog(this,hello,"Applet提示",0);    System.out.println(hello);  }}class AppletTest_button1_actionAdapter implements java.awt.event.ActionListener {  AppletTest adaptee;  AppletTest_button1_actionAdapter(AppletTest adaptee) {    this.adaptee = adaptee;  }  public void actionPerformed(ActionEvent e) {    adaptee.button1_actionPerformed(e);  }}

⌨️ 快捷键说明

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