Ⅰ PPT 选择题代码
打开PowerPoint ,在菜单里找 视图 --工具栏 -- 控件工具箱
就弹出控件工具箱了,然后和在vb里一样,把控件画到幻灯片上,双击控件后就打开代码编辑器,然后和vb里一样的
Ⅱ java中怎么编写多项选择题代码
importjava.awt.Checkbox;
importjava.awt.CheckboxGroup;
importjava.awt.Choice;
importjava.awt.FlowLayout;
importjava.awt.Label;
importjava.awt.TextField;
importjava.awt.event.ItemEvent;
importjava.awt.event.ItemListener;
importjavax.swing.JFrame;
{
/**
*
*/
=1L;
Labell1,l2;
TextFieldt1,t2;
CheckboxGroupcheckboxGroup=newCheckboxGroup();
Checkboxcheckbox1=newCheckbox("QQ",checkboxGroup,false);
Checkboxcheckbox2=newCheckbox("MSN",checkboxGroup,false);
Checkboxcheckbox3=newCheckbox("ICQ",checkboxGroup,false);
Choicec;
publicChoose(){
super("简单小程序");
this.setLayout(newFlowLayout());
l1=newLabel("选择你常用的软件:");
l2=newLabel("选择你喜欢的水果:");
checkbox1.addItemListener(this);
checkbox2.addItemListener(this);
checkbox3.addItemListener(this);
t1=newTextField(20);
t2=newTextField(20);
c=newChoice();
c.addItemListener(this);
c.add("苹果");
c.add("橘子");
c.add("香蕉");
c.add("梨子");
this.add(l1);
this.add(checkbox1);
this.add(checkbox2);
this.add(checkbox3);
this.add(t1);
this.add(l2);
this.add(c);
this.add(t2);
this.setSize(450,200);
this.setVisible(true);
}
publicstaticvoidmain(String[]args){
newChoose();
}
publicvoiditemStateChanged(ItemEvente){
if(e.getSource()==checkbox1){
t1.setText("你常用的软件是:"+checkbox1.getLabel());
}
if(e.getSource()==checkbox2){
t1.setText("你常用的软件是:"+checkbox2.getLabel());
}
if(e.getSource()==checkbox3){
t1.setText("你常用的软件是:"+checkbox3.getLabel());
}
t2.setText("你喜欢的水果是:"+c.getSelectedItem());//得到选中的下拉列表值
}
}