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

📄 choice1.java

📁 翁剀JAVA语言那门课程的教案 很多人都看多他的视频教程可惜没有ppt的教案
💻 JAVA
字号:
//:Choicel.java
// Using drop-down lists
import java.awt.*;
import java.applet.*;

public class Choice1 extends Applet {
	String[] description={"Ebullient","Obtuse",
		"Recalcitrant","Brilliant","Somneacent",
		"Timorous","Florid", "Putrescent"};
	TextField t=new TextField(30);
	Choice c=new Choice();
	Button b=new Button("add items");
	int count =0;
	
	public void init() {
		t.setEditable(false);
		for(int i =0;i < 4; i++)
			c.addItem(description[count++]);
		add(t);
		add(c);
		add(b);
	}
	
	public boolean action (Event evt,Object arg) {
		if(evt.target.equals(c))
			t.setText("index: " + c.getSelectedIndex()
				+ "  " +(String)arg);
		else if(evt.target.equals(b)) {
			if(count < description.length);
				c.addItem(description[count++]);
		}
		else
			return super.action(evt,arg);
		return true;
	}
}

//	<applet code=Choice1.class width=250 height=100></applet>

⌨️ 快捷键说明

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