Here is the text field code, and the method I wrote to return its' value:
textIn = new JTextField(20);
window2.add(textIn);
textIn.reshape(75, 50, 75, 30);
protected String getValue()
{
return textIn.getText();
}
I do have an enter button on this Frame, here is the Action Handler:
if (e.getSource() == btnEnter)
{
getValue();
setVisible(false);
}
And lastly, here is code from my main window where I am calling the value of the text field:
if(e.getSource() == btnCall)
{
windowIn = new InputWindow("How many minutes will you use?");
String minutesIn = windowIn.getValue();
int minutesOut = Integer.parseInt(minutesIn);
myPhone.makeCall(minutesOut);
}
I'm throwing an exception on this line
int minutesOut = Integer.parseInt(minutesIn);
Exception in thread "AWT-EventQueue-0" java.lang.NumberFormatException: For input string: ""
This post has been edited by synlight: 02 August 2012 - 04:52 PM

New Topic/Question
Reply




MultiQuote




|