1 19 20 package org.netbeans.modules.tasklist.usertasks.editors; 21 22 import java.awt.Component ; 23 import javax.swing.DefaultCellEditor ; 24 import javax.swing.DefaultComboBoxModel ; 25 import javax.swing.JComboBox ; 26 27 28 import javax.swing.JTable ; 29 import org.netbeans.modules.tasklist.usertasks.model.UserTask; 30 31 34 public class OwnerTableCellEditor extends DefaultCellEditor { 35 38 public OwnerTableCellEditor() { 39 super(new JComboBox ()); 40 ((JComboBox ) editorComponent).setEditable(true); 41 } 42 43 public Component getTableCellEditorComponent(JTable table, Object value, 44 boolean isSelected, int row, int column) { 45 46 java.awt.Component retValue; 47 48 retValue = super.getTableCellEditorComponent(table, value, isSelected, 49 row, column); 50 51 UserTask ut = (UserTask) value; 52 JComboBox cb = (JComboBox ) editorComponent; 53 DefaultComboBoxModel m = new DefaultComboBoxModel (ut.getList().getOwners()); 54 cb.setModel(m); 55 cb.setSelectedItem(ut.getOwner()); 56 57 return retValue; 58 } 59 } 60 | Popular Tags |