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))
{
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
BugFree
IchBin - 28 Apr 2006 02:59 GMT
> 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.
[quoted text clipped - 25 lines]
>
> BugFree
Not sure what your error is...? You did not explain?
You know you could just issue a Object.setName("Some Name") when you set
that Object.addActionListener(this).
So when when you check in the actionperformed method you can just check
for the name that you set the objects to: ex.
if(Object,get(Name().equals("Some Name"))
But don't know what your problem is and I gave up reading minds years ago.
Thanks in Advance...
IchBin, Pocono Lake, Pa, USA
http://weconsultants.servebeer.com/JHackerAppManager
__________________________________________________________________________
'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor, Regular Guy (1952-)
Thomas Weidenfeller - 28 Apr 2006 09:19 GMT
> please hurry
I don't think so. We are not your servants.
/Thomas

Signature
The comp.lang.java.gui FAQ:
ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/computer-lang/java/gui/faq
http://www.uni-giessen.de/faq/archiv/computer-lang.java.gui.faq/
Nigel Wade - 28 Apr 2006 10:40 GMT
> 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.
[quoted text clipped - 5 lines]
> 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();
[quoted text clipped - 14 lines]
>
> please hurry and thanks alot
What's the rush? Take life easy, and enjoy it while it lasts. It's gone all too
soon.

Signature
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