Trying to make the text field accept only integers
some how it either consumes everything I type in the field or it just lets to type anything it's simple that's why its hard to find the problem.
JLabel year = new JLabel("Year:");
final JTextField yeart = new JTextField(10);
yeart.addKeyListener(new KeyAdapter()
{
@Override
public void keyTyped(KeyEvent e)
{
super.keyTyped(e);
e.getKeyCode();
if (!(e.getKeyCode() >= 48 || e.getKeyCode() <= 57))
{
e.consume();
}
}
});