java下拉框

来源:互联网 发布:网络媒体广告投放 编辑:程序博客网 时间:2024/06/05 02:10
import java.awt.*;
import javax.swing.*;
public class list extends JApplet
{
 public void init(){
  String str[] = {"1","2","3","4","5","6","7"};
  JComboBox box = new JComboBox(str);
  box.setMaximumRowCount(4); //最多显示4列
  setLayout(null);
  box.setBounds(10,10,100,30);
  getContentPane().add(box,BorderLayout.NORTH);
 }
}