这个问题在这里已经有答案了:
将jcombobox添加到jtable单元格[重复](2个答案)
20天前关门了。
我遇到的问题是,每次尝试将组合框添加到jtable文本时,都会弹出一个没有实际jcombobox的文本,而不是jcombobox中的文本
jTable1 = new javax.swing.JTable();
JComboBox comboBox = new JComboBox();
comboBox.addItem("baby");
comboBox.addItem("new");
comboBox.setEditable(true);
jTable1.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{"Opportunity Assessment", null, comboBox, null, null},
{"IP Selection", null, null, null, null},
{"Value Proposition Canvas Suite", null, null, null, null},
{"Business Model Canvas", null, null, null, null},
{"Market Opportunity Navigator", null, null, null, null},
{"Porters 5 Forces-CSF", null, null, null, null},
{"100 Customer Interviews", null, null, null, null},
{"1000 Customer Surveys Complete", null, null, null, null},
{"Minimum Viable Product", null, null, null, null},
{"Competitive Advantage Chart", null, null, null, null},
{"Go-to-Market Board", null, null, null, null},
{"Financial Forecast-Link to Financials", null, null, null, null},
{"Risk Analysis", null, null, null, null},
{"Capital Needs-Link to Cap", null, null, null, null}
},
new String [] {
"Tasks", "Status", "Results", "Insights", "Decision"
}
));
jTable1.setEnabled(false);
jTable1.add(comboBox);
jScrollPane1.setViewportView(jTable1);
2条答案
按热度按时间2wnc66cl1#
我发现我忘了添加一行来访问列,然后添加组合框
zkure5ic2#
这个主题是7年前提出来的,可能会对你有所帮助。链接:
向jtable单元格添加jcombobox