当前位置:编程学习 > JAVA >>

JTable中如何添加控件

已经建好了一个JTable,现在我想在中间的某列添加JComboBox,怎么才能实现? --------------------编程问答-------------------- JTable表格某列加JComboBox:
    TableColumn column = 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");  
    column.setCellEditor(new DefaultCellEditor(comboBox));   
补充:Java ,  Java SE
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,