码迷,mamicode.com
首页 > 编程语言 > 详细

java Swing 之下拉列表控件

时间:2014-05-04 00:12:16      阅读:547      评论:0      收藏:0      [点我收藏+]

标签:java   swing   

/**
 * Java Swing 之下拉列表控件
 * @author gao
 */
package com.gao;

import java.awt.FlowLayout;

import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;

public class JComboBoxDemo extends JFrame{
	public JComboBoxDemo(){
		this.setTitle("下拉列表框使用");
		this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		this.setBounds(100,100,250,100);
		JPanel contentPane=new JPanel();
		contentPane.setBorder(new EmptyBorder(5,5,5,5));
		this.setContentPane(contentPane);
		contentPane.setLayout(new FlowLayout(FlowLayout.CENTER,5,5));
		JLabel label=new JLabel("证件类型:");
		contentPane.add(label);
		JComboBox comboBox=new JComboBox();
		comboBox.addItem("身份证");
		comboBox.addItem("驾驶证");
		comboBox.addItem("军官证");
		contentPane.add(comboBox);
		this.setVisible(true);
	}
    public static void main(String[]args){
    	JComboBoxDemo example=new JComboBoxDemo();
    }
}
bubuko.com,布布扣

java Swing 之下拉列表控件,布布扣,bubuko.com

java Swing 之下拉列表控件

标签:java   swing   

原文地址:http://blog.csdn.net/guanjungao/article/details/24875303

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!