java编写applet程序

来源:百度知道 编辑:UC知道 时间:2024/05/15 08:51:21
编写applet程序,界面中包括2个按钮,一个按钮用于放大applet上的一串字符串,一个按钮用于缩小连续点击可不断放大或缩小
谁会啊,课程设计的一道题

随意写了下,不是很好,楼主可参考下
=======================================
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;

public class MyApplet extends JApplet {

/** Creates a new instance of MyApplet */
public MyApplet() {
}

public void init(){
myFont = new Font("Dialog",Font.BOLD,16);

Bigger = new JButton("BIGGER");
Smaller = new JButton("Smaller");
jPanel1 = new JPanel();
jPanel2 = new JPanel();
jLabel1 = new JLabel("This is a test!!");
jLabel1.setFont(myFont);

jPanel1.setLayout(new FlowLayout());
jPanel1.add(Bigger);
jPanel1.add(Smaller);
jPanel2.add(jLabel1);

Container cp= this.getContentPane();
cp.setLayout(new BorderLayout());
cp.add(jPanel1,Bor