Need the program to display error message if the user input wrong date format. and if a person enters wrong input format, then it should display the error in the message dialog rather than the converted date.
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
Scanner input =new Scanner (System.in);
String date;
String m;
int day, month, year;
String[] totalmonths ={"", "January", "February", "March", "April", "May",
"June", "July", "August", "September", "October", "November", "December" };
date=jTextField1.getText();
StringTokenizer token = new StringTokenizer (date, "/");
month = Integer.parseInt (token.nextToken());
day= Integer.parseInt (token.nextToken());
year= Integer.parseInt (token.nextToken());
m= totalmonths [ month ];
//string check= month + day + year;
String result= m + "" + day + ", " + year;
JOptionPane.showMessageDialog(null, result);
}