Display users input
Hi i have a text field where users enter a value between 1-9. When i input 3 for example and display it i get
You entered 51.
Code
publicvoid keyPressed(KeyEvent evt)
{
int temp = evt.getKeyCode();
if( m_nShapesToDraw == 0 )
{
JOptionPane.showMessageDialog(MainWindow.this,"First if.");
if(( temp >= KeyEvent . VK_0 ) && ( temp <= KeyEvent . VK_9 ) )
{
JOptionPane.showMessageDialog(MainWindow.this,"second if.");
m_nShapesToDraw = temp;
hasEnteredValue =true;
cPanel.repaint() ;
JOptionPane.showMessageDialog(MainWindow.this,"third if.");
JOptionPane.showMessageDialog(MainWindow.this,"you enterend" +" " + temp);
}
}
Can somone tell me why i get 51 instead of 3? Does that mean it isn't really 3? Thanks
Message was edited by:
nvidia1

