JTable 表格中添加 JComboBox 控件
2015-09-25 19:00
302 查看
Using a Combo Box as an Editor
Setting up a combo box as an editor is simple, as the following example shows. The bold line of code sets up the combo box as the editor for a specific column.
Here is a picture of the combo box editor in use:
Setting up a combo box as an editor is simple, as the following example shows. The bold line of code sets up the combo box as the editor for a specific column.
TableColumn sportColumn = table.getColumnModel().getColumn(2); ... JComboBox comboBox = new JComboBox(); comboBox.addItem("Snowboarding"); comboBox.addItem("Rowing"); comboBox.addItem("Chasing toddlers"); comboBox.addItem("Speed reading"); comboBox.addItem("Teaching high school"); comboBox.addItem("None"); sportColumn.setCellEditor(new DefaultCellEditor(comboBox));
Here is a picture of the combo box editor in use:
相关文章推荐
- Qrcode生成二维码普通篇之jquery.qrcode.min.js
- UVA 11354 Bond
- 计算机思想的保养
- OC-类的加载和初始化
- Alcatraz 插件添加 (7.0)
- uva 822
- WebForm总结Day02_模板引擎_网页三层架构
- 随手记
- tcpdump
- abbreviations in english reading, writing, saying
- C++面试题(二)
- window添加右键菜单
- POJ 题目2823 Sliding Window(单调队列求定长区间最大值)
- 进程与线程及其区别
- android签名
- iOS:下拉刷新控件UIRefreshControl的详解
- HDU 3849(桥)
- 机器学习 Regularization and model selection
- 邮件开发
- Inheritance - SGU 129(线段与多边形相交的长度)