Win a copy of The Way of the Web Tester: A Beginner's Guide to Automating Tests this week in the Testing forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ctrl+tab is not working in editing mode

ashok rajendran
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have JcheckBox and JTable in my JPanel. When user clicks or presses F2 to edit any cell value of the JTable a comboBox will appear with possible values. (This comboBox is coming from table CellEditor). When user presses ctrl+tab from the table focus should transfer to JComboBox all time. It is working only when the user presses ctrl+tab from the table cell which is not in editing mode. If the user presses ctrl+tab from the table cell which is in editing mode (i.e. focus is on the ComboBox of the cellEditor) it does not work. Please help me to find the solution.

I give a sample code here for your reference.
public class Frame1 extends JFrame {
public Frame1()
this.setLayout( null );
this.setSize( new Dimension(400, 300) );

JTextField ch = new JTextField();
ch.setBounds(10, 10, 10, 10);
this.add(ch, null);

DefaultTableModel tmodel = new DefaultTableModel(3, 1);
tmodel.setValueAt("0 0 1",0,0);
tmodel.setValueAt("1 0 1",1,0);
tmodel.setValueAt("2 0 1",2,0);

JTable custLayersTable = new JTable(tmodel);
setCellEditor(new ComboEditor());
custLayersTable.setBounds(new Rectangle(40, 40, 280, 145));
this.add(custLayersTable, null);

public static void main(String[] args)
Frame1 a = new Frame1();

final class ComboEditor extends AbstractCellEditor
implements TableCellEditor
public Component getTableCellEditorComponent(JTable table,
Object value,
boolean isSelected,
int row,
int column)
Vector<String> layerValSet = new Vector<String>();
for(int i=0; i<3; i++)
layerValSet.add(row+" "+column+" "+i);
mComboModel = new DefaultComboBoxModel(layerValSet);
mEditorComp = new JComboBox(mComboModel);
return mEditorComp;

public Object getCellEditorValue()
return mEditorComp.getSelectedItem();

private DefaultComboBoxModel mComboModel;
private JComboBox mEditorComp;
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic