?? app17_1.java
字號(hào):
// app17_1, 建立選擇窗體
import java.awt.*;
class app17_1 extends Frame
{
static app17_1 frm=new app17_1();
static List lst=new List(); // 建立選擇窗體對(duì)象lst
public static void main(String args[])
{
frm.setLayout(new FlowLayout(FlowLayout.CENTER,10,25));
frm.setTitle("List class");
for(int i=0;i<=10;i++) // 利用for循環(huán)加入選項(xiàng)
lst.add("List Item "+i);
lst.select(2); // 選取索引值為2的選項(xiàng)
frm.setSize(200,150);
frm.add(lst);
frm.setBackground(Color.yellow);
frm.setVisible(true);
System.out.println("lst.getRows()= "+lst.getRows());
System.out.println("lst.getItemCount()= "+lst.getItemCount());
}
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -