Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / April 2006

Tip: Looking for answers? Try searching our database.

More than one event at a time

Thread view: 
BugFree - 28 Apr 2006 01:20 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.

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



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.