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

📄 myframe.java

📁 该程序主要用于计算样本的均值和方差
💻 JAVA
字号:
import javax.swing.*;
import javax.swing.event.*;

import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class MyFrame extends JFrame
{
	
	JButton bInput = new JButton("Input");
	JLabel l1 = new JLabel("please input number:");
	JLabel l2 = new JLabel("the result is:");
	JButton bJisuan = new JButton("JISUAN");
	JTextField input = new JTextField(10);
	JTextField output = new JTextField(20);
	ApplicationJSQ ap = new ApplicationJSQ();
	public void display()
	{
		this.setLayout(new FlowLayout());
		this.add(l1);
		bInput.getFocusListeners();
		add(input);
		add(bInput);
		add(bJisuan);
		add(l2);
		add(output);
		bInput.addActionListener(new ActionListener(){
			public void actionPerformed(ActionEvent arg0) {
				String s = input.getText();
				ap.addElement(Double.valueOf(s));
			}		
		});
		bJisuan.addActionListener(new ActionListener()
		{
			public void actionPerformed(ActionEvent arg0) {
				ap.aver = ap.average();
				ap.sner = ap.sn();
				String s = "average:"+ap.aver+"sn2:"+ ap.sner + ap.length();
				output.setText(s);
			}
			
		});
		this.setVisible(true);
		this.setSize(100,150);
	}
}

⌨️ 快捷键说明

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