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

📄 java_3.java

📁 里面有我的JAVA实验和一些教程
💻 JAVA
字号:
import java.applet.*;
import java.awt.*;
import java.awt.event.*;

public class GUI_text extends Applet implements ItemListener,ActionListener
{
	String a[] = {"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"};
	String b[] = new String[100];
	int i = 0,m = 0,j;
	Frame frm = new Frame("GUI编程");
	TextField tf = new TextField(20);
	TextArea ta = new TextArea(50,50);
	Choice co = new Choice();
	TextArea ta2 = new TextArea(50,50);
	
	public void init()
	{
		frm.setSize(500,500);
		frm.setLayout(null);
		
		tf.setSize(150,30);
		tf.setLocation(10, 30);
		frm.add(tf);
		tf.addActionListener(this);
		
		ta.setSize(200,200);
		ta.setLocation(160,30);
		frm.add(ta);
		
		co.setSize(120,30);
		co.setLocation(10, 250);
		for(i = 0 ; i < 26 ; i++)
		{
			co.addItem(a[i]);
			
		}
		frm.add(co);
		co.addItemListener(this);
		
		ta2.setSize(200,200);
		ta2.setLocation(160,250);
		frm.add(ta2);
		
		
		frm.setVisible(true);
		
	}
	
	public void actionPerformed(ActionEvent e)
	{
		String s = tf.getText();
		b[m] = s;
		m++;
		ta.append(s + "\n");
		tf.setText("");
	}
	
	public void itemStateChanged(ItemEvent e)
	{
		ta2.setText("");
		for(j = 0 ; j < m ; j++)
			if(b[j].substring(0,1).equals(co.getSelectedItem().toString()))
				ta2.append(b[j] + "\n");
	}
	
}

⌨️ 快捷键说明

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