📄 engllish_frame.java
字号:
/**
* Write a description of class EngllishFrame here.
*
* @author (your name)
* @version (a version number or a date)
*/
import java.awt.event.*;
import javax.swing.*;
import java.awt.*;
public class Engllish_Frame extends JFrame implements ActionListener
{
private JTextField StrTextField=new JTextField(40);
private JButton myButton=new JButton("统计");
private JLabel myLabel=new JLabel();
public Engllish_Frame()
{
setTitle("统计字母个数");
setLayout(new FlowLayout());
setSize(600,100);
add(StrTextField);
add(myButton);
add(myLabel);
myButton.addActionListener(this);
setVisible(true);
}
public void actionPerformed(ActionEvent e)
{
String Str,Str_out="";
//char temp='a';
int[] total=new int[26];
Str=StrTextField.getText();
English a=new English(Str);
a.E(total);
Str_out="A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z : ";
for(int i=0;i<26;i++)
{
Str_out+=total[i]+",";
}
myLabel.setText(Str_out);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -