1. You have a semi-colon after your if statement.
2. You can't use == when comparing strings, that compares memory. You must use singleChar.equals("a");
Code:
if (singleChar=="a");
So really, that's like:
Code:
if (singleChar == "a") {
;
}
So if singleChar did have the same memory location as "a" (which it wouldn't), no code would be executed! 
After that, it sees:
Code:
{
vowelCount++;
System.out.println("match");
}
So it just goes right along and executes that.
i wouldn't even do it the way you did
. I would do it like this:
Code:
public void actionPerformed( ActionEvent e ) {
/** store the String value of fieldText into String str */
String str = fieldText.getText();
/** vowelCount will be used to count the vowels in str */
int vowelCount = 0;
/** loop str.length() times */
for( int i = 0; i < str.length(); i++ ) {
/**
* take the character at the i position in str
* ( "hi".charAt( 0 ); would be 'h', "hi".charAt( 1 ); would be 'i' )
*/
char ch = str.charAt( i );
/** switch can be used for ints and chars (which are basically the same thing) */
switch( ch ) {
/** if ch is 'a', 'e', 'i', 'o', or 'u', increase the vowelCount and print "match" */
case 'a':
case 'e':
case 'i':
case 'o':
case 'u':
vowelCount++;
System.out.println( "match" );
break;
/**
* even though this does nothing, it's good to have
* it in case you decide to do something like counting the consonants
*/
default:
break;
}
}
/** display amount of vowels */
JOptionPane.showMessageDialog( null, "Total number of vowels: " + vowelCount );
}
Bookmarks