1 21 package org.jacorb.imr.util; 22 23 import javax.swing.*; 24 import java.awt.Component ; 25 33 34 public class ImRTableCellEditor extends DefaultCellEditor { 35 36 public ImRTableCellEditor(JComboBox box){ 37 super(box); 38 } 39 40 43 public Component getTableCellEditorComponent(JTable table, 44 Object value, 45 boolean isSelected, 46 int row, 47 int column){ 48 49 super.getTableCellEditorComponent(table, value, isSelected, row, column); 50 51 JComboBox _box = (JComboBox) editorComponent; 52 53 for(int _i = 0; _i < _box.getItemCount(); _i++){ 55 if(((String ) value).equals((String ) _box.getItemAt(_i))){ 56 _box.setSelectedIndex(_i); 57 break; 58 } 59 } 60 61 return _box; 62 } 63 64 } 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | Popular Tags |