• Post Reply Bookmark Topic Watch Topic
  • New Topic

JTextField

 
Jim Frank
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the best way to determine if a JTextField has exactly 8 digits in it; and how to send an error message to the user? Thanks.
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving this to the Swing / JFC / AWT forum...
 
Garandi Garandi
Ranch Hand
Posts: 192
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
implement javax.swing.InputVerifier and do your error checking in public boolean verify(JComponent input). But you might have a problem when you want to pop up a JOptionpane. Search for InputVerifier iin this forum and you might be able to get the answer.
Thank you
Garandi
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!