• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

problem with showMessageDialog  RSS feed

 
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone,
I seem to be having trouble displaying a message dialog.My application requires user input to a textField in a specific format(say hh-mm-ss).And whenever user enters invalid i/p,a dialog should appear saying "this is the wrong format.Please enter in the format hh-mm-ss" and in the dialog there is only one button ok.when pressed the user should be prompted to enter i/p again.

I am using JOptionsPane.showMessageDialog which is showing the dialog,but my application hangs when i click ok.Can someone please help me with the listener for the ok button.
Thanks,
Thejaswini.
 
Rancher
Posts: 1449
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You may want to post your code so people may see what is going on.
 
Ranch Hand
Posts: 1078
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No listener is needed. This is almost certainly unrelated to showMessageDialog() and is a problem with the code you've written that follows it.
 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
indeed. The way I validate user input is in this way:



Messages.java

 
thejaswini ramesh
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks John,Ken & Dieter...well my code is way too long to post completely.I will post only part of it...now i have written a custom dialog with ok button and a listener for tht.Please see if it makes any sense to you...I know am doing something wrong here but not able to figure it out...



Thanks for your time.
Thejaswini.
 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this might be one way.

needs testing to ensure the hour range is what you want

 
thejaswini ramesh
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks everybody...John, Ken ,Dieter & Michael...now my code is working.
The basic problem seems to be the code following showMessageDialog like you suggested ken.Once again thanks to all of you.

Thejaswini.
 
Can you shoot lasers out of your eyes? Don't look at this tiny ad:
ScroogeXHTML - small and flexible RTF to HTML converter library
https://coderanch.com/t/710903/ScroogeXHTML-RTF-HTML-XHTML-converter
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!