编写apple包含两个按钮一个按钮用于放大applet上的一串字符串 一个按钮用于缩小 连续点击可不断放大或缩小

来源:百度知道 编辑:UC知道 时间:2024/09/20 11:44:39
找了很多,没有全的正确,希望您能给个正确的!

import java.applet.Applet;
import java.awt.Button;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Rectangle;

public class Exp8_4 extends Applet {

private static final long serialVersionUID = 1L;
private Button button = null;
private Button button1 = null;
int zihao = 20;
/**
* This is the default constructor
*/
public Exp8_4() {
super();
}

/**
* This method initializes this
*
* @return void
*/
public void init() {
this.setLayout(null);
this.setSize(300, 200);

this.add(getButton(), null);
this.add(getButton1(), null);
}

/**
* This method initializes button
*
* @return java.awt.Button
*/
private Button getButton() {
if (button == null) {
button = new Button();
button.setBounds(new Rectangle(23, 134, 71, 23));
button.setLabel("放大");
but