값이있는 Enum을 포함하는 클래스가 있습니다. (이름) 다른 클래스에서이 열거 형 값을 사용할 셀 유형의 JCombobox 테이블에 입력하고 싶습니다. 내 문제는 문자열 값과 열거 형을 결합하는 것입니다. 예를 들어 열거 클래스 :테이블 내에 enum 값을 포함하는 JCombobox
열거 ITEM_TYPE {앙트레, main_Meal, 디저트, 음료} 예를 들어
테이블 클래스 : setTitle이라는 ("새 항목 추가"); setSize (300, 80); setBackground (Color.gray);
// Create a panel to hold all other components
topPanel = new JPanel();
topPanel.setLayout(new BorderLayout());
getContentPane().add(topPanel);
//new JComboBox(item_Type.values());
JComboBox aaa = new JComboBox();
aaa = new JComboBox(item_Type.values());
TableColumn sportColumn = table.getColumnModel().getColumn(2);
// Create columns names
String columnNames[] = {"Item Description", "Item Type", "Item Price"};
// Create some data
String dataValues[][] = {{ "0", aaa, "0" }};
// Create a new table instance
table = new JTable(dataValues, columnNames);
// Add the table to a scrolling pane
scrollPane = new JScrollPane(table);
topPanel.add(scrollPane, BorderLayout.CENTER);
dataValues 배열에서 나는 aaa (enum jcombobox)를 사용할 수 없다는 것을 알고 있습니다. 어떻게하면됩니까? 사전에
감사합니다.