TextField Please read this I have a Problem Please Help!!
I am writing an application
I created one TextField and one Button.
The user specifies a month and a year on the
Textfield,
Ex 11/1999
then clicks the show button to display the calender for the month of the year
Now my problem is once I get the String from the text field how can I differentiate between 11 and
1999.
Re: TextField Please read this I have a Problem Please Help!!
Re: TextField Please read this I have a Problem Please Help!!
Search for the '/' delimiter in the string
and take away the tokens on both sides of it.
Use StringTokenizer class.
Kannan
Re: TextField Please read this I have a Problem Please Help!!
Use StringTokenizer to parse the String
String textFieldString = textField.getText();
StringTokenizer sToken = new StringTokenizer( textFieldString , "/" );
if( sToken.countTokens() == 2 ){
String strMonth = sToken.nextToken();
String strYear = sToken.nextToken();
}else{
// Show Error Message
}