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

📄 example7_9.java.bak

📁 不错的教程 适合中高级人员的使用
💻 BAK
字号:
import java.awt.*;
import java.awt.event.*;
import java.util.*;

class  WindowTextArea extends Frame implements TextListener,ActionListener
{
	TextArea text1,text2;
	Button buttonClear;
	   
	WindowTextArea()
	{
     setLayout(new FlowLayout());
	 text1=new TextArea(6,15);
	 text2=new TextArea(6,15);
	 buttonClear=new Button("清空");
	 add(text1);add(text2);
	 add(buttonClear);
	 text2.setEditable(false);
	 text1.addTextListener(this);
	 buttonClear.addActionListener(this);
	 setBounds(100,100,350,160);
	 setVisible(true);
	 validate();
	}

	public void textValueChanged(TextEvent e)
	{
		String s=text1.getText();
		StringTokenizer fenxi=new StringTokenizer(s,",'\n'");
		int n=fenxi.countTokens();
		String a[]=new String[n];
		for(int i=0;i<=n-1;i++)
		{
			String temp=fenxi.nextToken();
			a[i]=temp;
		}
		Arrays.sort(a);
		text2.setText(null);
		for(int i=0;i<=n;i++)
		{
			text2.append(a[i]+'\n');
		}

	}
	public void actionPerformed(ActionEvent e)
	{
		text1.setText(null);
	}

}

public class Example7_9
{
	public static void main(String[] args) 
	{
		WindowTextArea win=new WindowTextArea();
	}
}

⌨️ 快捷键说明

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