📄 app17_3.java
字号:
// app17_3, 建立选择窗体
import java.awt.*;
public class app17_3 extends Frame
{
static app17_3 frm=new app17_3();
static Choice chc=new Choice(); // 建立下拉菜单对象chc
public static void main(String args[])
{
frm.setLayout(new FlowLayout(FlowLayout.CENTER,10,10));
frm.setTitle("Choice class");
for(int i=0;i<=4;i++) // 利用for循环加入选项
chc.add("Choice Item "+i);
frm.setSize(200,150);
frm.add(chc);
frm.setBackground(Color.yellow);
frm.setVisible(true);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -