javax.swing.JComboBox를 org.jdesktop.swingx.JXTable 셀에 넣는 데 문제가 있습니다. 나는이 문제에 대한 이전 질문을 열람했으나 도움이되지는 못했다.JTable 셀의 JComboBox
colModel.getColumnExt(HDTableAdapter.STATUS).setCellEditor(editorCB);
colModel.getColumnExt(HDTableAdapter.STATUS).setCellRenderer(rendererCB);
class comboBoxRenderer extends JComboBox implements TableCellRenderer {
public comboBoxRenderer(String[] items) {
super(items);
}
public Component getTableCellRendererComponent(JTable table, Object value,
boolean isSelected, boolean hasFocus, int row, int column) {
if (isSelected) {
setForeground(table.getSelectionForeground());
super.setBackground(table.getSelectionBackground());
} else {
setForeground(table.getForeground());
setBackground(table.getBackground());
}
setSelectedItem(value);
return this;
}
}
class comboBoxEditor extends DefaultCellEditor {
public comboBoxEditor(String[] items) {
super(new JComboBox(items));
}
}
을하지만,이 경우에, 나는 세포 내부하지 않은 편집 가능한 콤보 상자를 얻을 :
나는 시도했다.
자바 명명 규칙을 배우십시오 왜 당신이 깜짝 – kleopatra
그들을 스틱? JComboBox는 기본적으로 _not_ 편집 가능하지 않습니다. – kleopatra
하나의 주석은 다른 것을 쫓고 있습니다 JXTable 비트를 알았습니다 : _dont_ 렌더러를 구현하고 (대신 SwingX!), 지원되지 않는 구성 요소 유형에 대해 ComponentProvider를 서브 클래 싱합니다 (테스트 섹션의 xxVisualCheck에 예제가 있습니다. , xx == Renderer 또는 == JXTable (정확히 말하면 정확히 말하지 않을 것) –
kleopatra