编写一个Applet,该程序请求用户输入圆的半径,然后显示该圆的直径、周长和面积

来源:百度知道 编辑:UC知道 时间:2024/05/22 15:03:47
高手快来帮忙啊~~~~!!!!1

import javax.swing.*;
import java.awt.*;

public class MyJApplet extends JApplet {
private JButton jButton1;
private JEditorPane jEditorPane1;
private JLabel jLabel1;
private JLabel jLabel2;
private JScrollPane jScrollPane1;
private JTextField jTextField1;
public void init() {
try {
java.awt.EventQueue.invokeAndWait(new Runnable() {
public void run() {
initComponents();
}
});
} catch (Exception ex) {
ex.printStackTrace();
}
}
private void initComponents() {
jLabel1 = new JLabel();
jTextField1 = new JTextField("请输入圆的半径");
jButton1 = new JButton();
jEditorPane1 = new JEditorPane();
jLabel2 = new JLabel();
jLabel1.setText("输入圆的半径:");
jButton1.setText("计算");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt)