This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Murach's Python Programming and have Michael Urban and Joel Murach on-line!
See this thread for details.
Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JOptionPane Errors  RSS feed

 
Jayden Pickett
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey

After the user types in a string and presses enter, I want an error message to pop up. I am trying to use JOptionPane to do this, but the program gets hung up when it hits the JOptionPane line. My code is:

if(Select.equals("\r\n")) {
JOptionPane.showMessageDialog(frame, "You pressed Enter.", "Error", JOptionPane.ERROR_MESSAGE);
}

any ideas
 
Kinu Kanwar
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did it pass the if check ?

If yes then there might be problem with your frame object ? Try to pass null for testing instead of frame and see what happens ?

Kinu
 
Stuart Gray
Ranch Hand
Posts: 410
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the user presses enter alone, the result will be an empty String (select.length()==0).
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!