Hi,
I am having a j table. if i click the column and add
string, the column do the numeric validation.
And if i press tab to the column and insert some string value, the column accept it.
This happen as i add Jtextfield into the j table column. Only if the user click on the column the JTextField will
come into action. And if the user simple TAB to the column and add value , then the JTextField will not get activated and the column might accept string value.
Please suggest how i can make the TAB operation set focus to the column's text field OR please suggest alternative for this issue.
Thanks.
TableColumn TC1 = table.getColumnModel().getColumn(1);
final JTextField text = new JTextField();
text.addKeyListener(new KeyAdapter() {
public void keyReleased(KeyEvent EVT) {
String value = text1.getText();
int l = value.length();
if ((EVT.getKeyChar() >= '0' && EVT.getKeyChar() <= '9') || EVT.getKeyChar()=='.'|| EVT.getKeyChar()=='\b' ) {
} else {
JOptionPane.showMessageDialog(null, "Please enter numeric value only")
text.setText("");
}}
});
table.setDefaultEditor(Object.class, new DefaultCellEditor(text));