I don't know what to ask for. Need a dialog box for a erorr

Can anyone tell me or show me a sample of code the will allow me to have an error dialog box.
I have a date that when the date format is wrong a dialog box pops up and informs the user of the correct date format.
This is the code that changes the background of the text box to red and stops the user for going on. I would be nice to have a dialog instead.
void DOBJText_focusLost(FocusEvent e) {
try
if (! DOBJText.getText().equals(""))
SimpleDateFormat df = new SimpleDateFormat("dd/mm/yyyy");
Date d = df.parse(DOBJText.getText());
DOBJText.setBackground(Color.white);
else
DOBJText.setBackground(Color.white);
catch (ParseException pe)
DOBJText.grabFocus();
DOBJText.setBackground(Color.red);
Thanks for any help
Craig

Sorry I should have looked Harder as I have found this.
the problem is that it opens up twice
anyone knows why this would happen ??
this is the code
void DOBJText_focusLost(FocusEvent e) {
try
if (! DOBJText.getText().equals(""))
SimpleDateFormat df = new SimpleDateFormat("dd/mm/yyyy");
Date d = df.parse(DOBJText.getText());
DOBJText.setBackground(Color.white);
else
DOBJText.setBackground(Color.white);
catch (ParseException pe)
JOptionPane.showMessageDialog( this,
"Date format needs to be DD/MM/YYYY", "Date Format Error",
JOptionPane.ERROR_MESSAGE );
}

Similar Messages

Maybe you are looking for

  • Error in source system while extracting the data from R/3!

    Hi, i had created FM and extract strcucture in R/3 . using the above two, i had created data source using RSO2 T code. when i checked the extractor ( RSA3 T code) in R/3  it was working fine . (status messege displayed as 1000 records selected). then

  • Special GL

    Hello How do we deal with Letter of credit, Bills of exchange, Post date checks and Guarantees. I understand that we use the special gl transactions and statistical postings to take care of these. What I want to understand is how the accounting proce

  • Why is "Reduce File Size" in the "File" menu always disabled?

    I have a rather large presentation file, about 100Mbyte, and Keynote has become almost impossible to use, because it has become so slow. Have to wait about 5 seconds for each letter to appear on screen after typing! Almost impossible to use Keynote u

  • Windows update cannot currently check for updates

    dears when I Try to update my windows 7 by clicking on windows update ( control panel or windows update) I get some notification saying "windows update cannot currently check for updates because of the service is not running you may need to restart t

  • Reduce project, Remove duplicates and Replace Source

    I'm moving a project from FCP7 to PPCS5 and I'm running into an issue. importing an XML from FCP7 brings all the project assets in to one folder, but I'd like to orginize them along with all of the original source in specified Bins (Footage, Audio, G