题目内容

本题的功能是对下拉菜单项的操作,包括添加和删除。页面包括一个下拉菜单、一个文本框和两个按钮“删除”和“添加”,选中下拉菜单的一项后,可以通过“删除”按钮从下拉菜单中删除该项,在文本框中填入字符串后,单击“添加”按钮就可以将该项添加到下拉菜单中,所有信息都将显示在右侧的文本域中。 import java.awt.*; import java.awt.event.*; public class java2 extends java.applel.Applet imple-ments ItemListener,ActionListener Choice choice; Textield text; TextArea area; Button add,del; public void init() choice=new Choice(); text=new TextField(8); area=new TextArea(6,15); choice.add("音乐天地"); choice.add("武术天地"); choice.add("象棋乐园"); choice.add("交友聊天"); add=new Button("添加"); del=new Button("删除"); add.addActionListener(this); del.addActionListener(this); choice.addltemListener(this); add(choice); add(del);add(text);add(add);add(area); public void itemStateChanged(ItemEvent e) String name=______; int index=choice.getSelectedIndex(); area.setText("\n"+index+":"+name); public void actionPerformed(ActionEvent e) if(e.getSource()==add||e.getSource()==text) String name=text.getText(); if(name.length()>0) choice.add(name); choice.select(name); area.append("\n添加"+name); else if(e.getSource()==del) choice.remove(______); area.append("\n删除"+choice.getSelectedItem ());

查看答案
更多问题

有如下程序: Private Sub Command1_Click() j =10 For i= -1 To 1 Step 0.3 j =j + 1 Next i Print j End Sub该程序共循环 【7】 次,程序执行完毕后j的值是 【8】 。

Conversation 2[听力原文]9-10W: What’s going on hereM: You mean, what’s happening Well, constable, I’m trying to get out of the window and Freud here is helping me.W: Why are you climbing through the window and not leaving by the front doorM: Well. you see I can’t find the key and I’m in a hurry. Come on, Freud, we’re wasting time.W: Just a minute you two. I don’t think you’re telling me the truth. This isn’t your house, is itM: No. it’s my brother’s. I’m staying with him for a while.W: Is he at homeM: I’m afraid not. He’s just in jail for house-breaking at the moment Who did the woman think the mall was()

A. The host of the house.
B. Freud’s friend.
C. A burglar.
D. The host’s brother.

在窗体上画一个命令按钮,然后编写如下事件过程: Private Sub CommAnd1_Click() For i=1 To 4 x=0 For j=1 To 3 x=j For k=1 To 2 x=x+6 Next k Next j Next i Print x End Sub 程序运行后,单击命令按钮,输出结果是______ 。

A. 7
B. 15
C. 157
D. 538

[听力原文]W: Can I help you. SirM: Yes, can you show me the way to Gate 9 for Flight 911 to Hong Kong I’m quite confused here. Which Flight will the man take()

A. Plight 811.
B. Flight 611.
C. Flight 711.
D. Flight 911.

答案查题题库