bgigurtsis
bgigurtsis

Reputation: 131

Making JOptionPane not case sensitive?

I can't seem to find out anywhere but if I remember correctly there was something you could add to the end of a JOptionPane statement to make it case insensitive ? Here's my code, focusing on string a

....  scanner.close();
for (int i = 1; i < lines.size(); i += 2)
{
}

Upvotes: 2

Views: 1362

Answers (1)

aioobe
aioobe

Reputation: 421100

It's not really about JOptionPane, but what happens after it has done its work :-)

Use equalsIgnoreCase when comparing the two strings.

if (a.equalsIgnoreCase(answer) && input.equals("instant")) {
            ^^^^^^^^^^
    ...
}
else if (a.equalsIgnoreCase(answer) && input.equals("generate")) {
                 ^^^^^^^^^^
    ...
}

Upvotes: 5

Related Questions