1 19 20 package org.netbeans.modules.tasklist.usertasks.editors; 21 22 import java.awt.Component ; 23 24 import javax.swing.DefaultCellEditor ; 25 import javax.swing.JComboBox ; 26 import javax.swing.JTable ; 27 28 import org.netbeans.modules.tasklist.usertasks.model.UserTask; 29 import org.netbeans.modules.tasklist.usertasks.renderers.PriorityListCellRenderer; 30 31 34 public class PriorityTableCellEditor extends DefaultCellEditor { 35 38 public PriorityTableCellEditor() { 39 super(new JComboBox (new Integer [] { 40 new Integer (UserTask.HIGH), 41 new Integer (UserTask.MEDIUM_HIGH), 42 new Integer (UserTask.MEDIUM), 43 new Integer (UserTask.MEDIUM_LOW), 44 new Integer (UserTask.LOW), 45 })); 46 ((JComboBox ) editorComponent).setRenderer(new PriorityListCellRenderer()); 47 } 48 49 public Component getTableCellEditorComponent(JTable table, Object value, 50 boolean isSelected, int row, int column) { 51 ((JComboBox ) editorComponent).setSelectedItem(value); 52 return editorComponent; 53 } 54 55 public Object getCellEditorValue() { 56 return ((JComboBox ) editorComponent).getSelectedItem(); 57 } 58 } 59 | Popular Tags |