Re: More than one event at a time
BugFree wrote:
I'm trying to create something that handles more than one event in the
same window here is a bit of code that wont work right.
if(e.getSource().equals((JButton)mapButtons[0]))
{
txtCaps.setText("Juneau");
if(e.getSource().equals((JButton)check))
{
This block can never be entered unless both
e.getSource().equals((JButton)mapButtons[0]) *and*
e.getSource().equals((JButton)check)
which implies mapButtons[0].equals((JButton)check)
String str ="alaska";
str.toLowerCase();
if(txtState.getText().toLowerCase().equals(str))
{
correct++;
txtState.setText("Good Job");
}
else
{
wrong++;
txtState.setText("Try again");
}
}
This is all in the actionPerformed method
please hurry and thanks alot
What's the rush? Take life easy, and enjoy it while it lasts. It's gone all too
soon.
--
Nigel Wade, System Administrator, Space Plasma Physics Group,
University of Leicester, Leicester, LE1 7RH, UK
E-mail : nmw@ion.le.ac.uk
Phone : +44 (0)116 2523548, Fax : +44 (0)116 2523555