A question about firing event, please help

I would like to know how to fire an event in the following situation:
public class FireAnEvent
         public static void main()
               char c=(char)System.in.read())s;
               String source="I'm the source";
               if(c!="a")
                      fireActionEvent(new ActionEvent(source,1,null);
}the above code won't work obviously, but what should i do to make it work, or is it possible to fire in this situation?
thanks in advance;
Message was edited by:
fandebiao

My personal favourite way to quickly fire custom events is through using enums in the XXXEvent class. That way checking which event was called is easy, and it's also typesafe.
fireXXXEvent(XXXEvent.ID.MY_ID, "...");
  private List<XXXListener> listeners = new LinkedList<XXXListener>();
  private synchronized void fireXXXEvent(XXXEvent.ID eventID, String args) {
    XXXEvent event = new XXXEvent(this, eventID);
    event.setupOtherStuff(args);
    for (XXXListener l : listeners) {
      switch (eventID) {
        case MY_ID:
          l.xxxAction(event);
          break;
        case MY_OTHER_ID:
          l.xxxOtherAction(event);
          break;
        default:
          break;
  public synchronized void addXXXListener(XXXListener l) { listeners.add(l); }
  public synchronized void removeXXXListener(XXXListener l) { listeners.remove(l); }

Similar Messages

  • Question about Regular Expressions, please help!

    I have created an app which reads files and extracts certain data using regular expressions in JDK1.4 using Pattern and Matcher classes.
    However it needs to run on JDK1.2.2 (dont ask). The regular expression classes are not available in 1.2.2 (the Pattern and Matcher class) so i am looking for something similiar which i can use?
    I need something that loops through all the matches found in the file like how Matcher works i.e.
    while (matcher.find())
    // do this
    Help!

    http://jakarta.apache.org/regexp/

  • A question about arrays. Please Help

    Ok here is my question lets say i have a multie varible array such as
    int[][] thisList = new int[3][64];And I have a number of other arrays that are single variable arrays, and which have data stored in them.
    List1[64]
    List2[64]
    List3[64]is there a way i can store all these three list in the multie varible array?
    for example i know i can do this, > Correct me if i am wrong
    List1 = List2; where List1 one now contains all the elements that List2 has.
    but is there a way i can
    us the same format with a multie varible array, to store all three list in it.
    such as thisList[1][] = List1; thisList[2][] = List2[]; Thanks

    for example i know i can do this, > Correct me if i
    am wrong
    List1 = List2; where List1 one now
    contains all the elements that List2 has.There will be one array. Both the List1 and List2 reference variables will point to that same array.
    (By the way, convention in Java is for variables to start with lowercase.)
    >
    but is there a way i can
    us the same format with a multie varible array, to
    store all three list in it.
    such as thisList[1][] = List1; thisList[2][] =
    List2[];
    You can do thisList[1] = List1 if thisList is an int[][] and List1 is an int[]. However, that will not copy any ints. It will just do the same as the above--cause the reference thisList[1] to point to the same array object as List1 does.
    If you want to copy values from one array to another, use System.arraycopy.

  • Question about lost iPod - Please help me out!!

    My iPod was stolen and is there anyway to relocate it if it connect to someone's computer? Could Apple track it down? And I am not sure whether I have registered my iPod online. Is there anyway to check??

    Apple have no process in place to either report or track stolen iPods. All you can do is report the theft to the Police together with it's serial number, and if your iPod was registered with Apple when you first got it, they will assist the Police in returning it to you should it ever be recovered.

  • A question about NAST_CREATE_MESSAGE_OBJECT?Please help

    Hello:
       We are now using function:NAST_CREATE_MESSAGE_OBJECT to create an EDI message into NAST in our program.But there is alwasys the following message when NAST_CREATE_MESSAGE_OBJECT is called and then this function will fail.Could you tell me how I can fix this issue?
    Function module SO_NAME_CONVERT with return code
                                                  7
    completed
    No message title for condition type E in
    maintained
    Thanks

    Launch Terminal.app
    Type cd followed by a space. Do not hit return key just yet.
    In Finder, navigate to folder containing the files you want to blow away.
    Drag and drop that folder (in the finder) into the Terminal.app window. It'll autofill the path to the directory containing the files you're wanting to blow away. Now hit the return key.
    You could type ls (that's a lower-case ell) and see the directory listing of all the files in your current directory. Probably a good idea to do just to doublecheck that you really are in the directory that you want to blow away all these files from.
    Now do what Greg said.
    Don't get impatient because Terminal is just sitting there and you're not getting an immediate command prompt. It'll take a while to blow away 9000 files.
    For entertainment, instead of rm *" copy"* use rm -v *" copy"* so you can watch all 9000 file names be printed in your terminal window as they are being deleted.
    Will it work? Oh yes .... irreversibly (if it doesn't, that's coz' there are some file ownership and/or file permission issues that need to be looked at, but assuming those are "compatible" with your current Terminal user environment, those guys'll be toast. Any file that's in the working directory where you are in Terminal that has the five characters " copy" in its filename will be history.
    The assumption in Greg's command is that all the files you want to blow away all reside in the one directory that you have navigated to.

  • WHEN-CUSTOM-ITEM-EVENT - not firing. Please Help

    Hi Grant,
    WHEN-CUSTOM-ITEM-EVENT - not firing. Please Help..
    I need a help from you.
    1) I have developed an form to browse the client machine and upload the file on server / table
    2) Registered the form in Oracle Apps 11.5.10.
    3) Currently i am able to open the File_Dialog and browse throught the clients machine
    But when ever user selects any file and says Open, i am not able to retrieve the file name. wHEN-CUSTOM-ITEM-EVENT is not
    firing. I am sure how we can invoke this CUSTOM-ITEM-EVENT.
    To devlop the form i have referred PERWSIMG.fmb - of Oracle (Apps) HRMS which uploads the employee photo in the Database.
    Hence i have used the same java code / Implementaion Class.
    Please help...
    Regards
    Sameer

    Hi Francois,
    You were right. I re-loaded the zip file and the original version works. Odd, as I don't remember ever modifying those files.
    But my original issue still remains.
    The only code I've added is this:
    Color mycolor = this.getBackground() ;
    setBackground(mycolor);to the CalendarFrame constructor. How could this be causing the trigger to not fire?
    Could it be the way I created the bean? I copied all the java files to my project, attached the libraries, created a deployment profile. Everything compiles without errors or warnings, and the jar is created without issues. The java console doesn't give any errors either.
    Thanks for all your help,
    A
    Edited by: Abigail Parmar on Mar 26, 2009 1:01 PM

  • HT5312 i cannot remember the answers to my security questions.  Can you please help me reset them?

    I cannot remember the answers to my security questions. Can you please help me reset them?

    Alternatives for Help Resetting Security Questions and Rescue Mail
         1. Apple ID- All about Apple ID security questions.
         2. Rescue email address and how to reset Apple ID security questions
         3. Apple ID- Contacting Apple for help with Apple ID account security.
         4. Fill out and submit this form. Select the topic, Account Security.
         5.  Call Apple Customer Service: Contacting Apple for support in your
              country and ask to speak to Account Security.
    How to Manage your Apple ID: Manage My Apple ID

  • I can't remember answers from security questions... Please help me....apple support don't answer.(((

    I can't remember answers from security questions... Please help me....apple support don't answer.(((

    1. See my User Tip for some help: Some Solutions for Resetting
        Forgotten Security Questions: Apple Support Communities.
    2. Here are two different but direct methods:
        a. Send Apple an email request at: Apple - Support - iTunes Store - Contact Us.
        b. Call Apple Support in your country: Customer Service: Contacting Apple for
            support and service.
    3. For other queries about Apple ID see Frequently asked questions about Apple ID.
    4. Rescue email address and how to reset Apple ID security questions
    5. For online assistance use Apple - Support - Express Lane

  • Hi . im forget security questions in apple id please  help me

    im forget security questions in apple id please  help me

    See Here..
    Apple ID: Contacting Apple for help with Apple ID account security
    Or Here  >  Apple  Support  iTunes Store  Contact

  • Hi, Please tell me how can I send the Music Videos to the I Pod From the Computer, I'm so upset about this problem, Please help me ASAP.

    Hi, Please tell me how can I send the Music Videos to the I Pod From the Computer, I'm so upset about this problem, Please help me ASAP.

    Here:
    iTunes 11 for Mac: Set up syncing for iPod, iPhone, or iPad
    or
    iTunes 11 for Windows: Set up syncing for iPod, iPhone, or iPad

  • I forgot the password of icloud and i forgot the security question also can you please help me

    i forgot the password of icloud and i forgot the security question also can you please help me

    it's [email protected]

  • HT201303 I cannot purchase anything using my apple account because I forgot my security questions. Can you please help me?

    I forgot my security answers to my questions and cannot access or purchase anything. Please help
    <Email Edited by Host>

    Reset Security Questions
    Frequently asked questions about Apple ID
    Manage My Apple ID
    Or you can email iTunes Support at iTunes Store Support.
    If all else fails:
      1. Go to: Apple Express Lane;
      2. Under Product Categories choose iTunes;
      3. Then choose iTunes Store;
      4. Then choose Account Management;
      5. Now choose iTunes Store Security and answer the bullet questions, then click
          Continue;
      6. Sign in with your Apple ID and press Continue;
      7. Under Contact Options fill out the information and advise iTunes that you would
          like your security/challenge questions reset;
      8. Click Send/Continue.
    You should get a response within 24 hours by email.
    In the event you are unsuccessful then contact AppleCare - Contacting Apple for support and service.
    Another user had success doing the following:
    I got some help from an apple assistant on the phone. It is kind of round about way to get in.
    Here is what he said to do and it is working for me...
      a. on the device that is asking you for the security questions go to "settings", > "store" >
          tap the Apple ID and choose view"Apple ID" and sign in.
      b. Tap on payment information and add a credit/debit card of your preference then select
          "done", in the upper right corner
      c. sign out and back into iTunes on the device by going to "settings"> "store" > tap the
          Apple ID and choose "sign-out" > Tap "sign -in" > "use existing Apple ID" and you
          should be asked to verify your security code for the credit /debit card and NOT the
          security questions.
      d. At this time you can remove the card by going back in to edit the payment info and
          selecting "none" as the card type then saving the changes by selecting "done". You
          should now be able to use your iTunes store credit without answering the security
          questions.
    It's working for me ...I just have to put in my 3 digit security pin from the credit card I am using.
    Good Luck friends!

  • I need answers about the iCloud - Please help

    Hi guys, well I have a few iOS devices, 2 ipads, and an iphone. Well, I got a few questions to ask.
    1. Ok, on my iphone on settings on the icloud bit, I have my iphone back up aswell as the 2 ipads. What will happen if I delete the back up for 1 of the ipads. Like, I don't know whats on the back up. And If I want a new back up for the ipad, how to I create 1?
    2. On the icloud section with all 3 ios devices, my 5gb of storage is full, and each device has a bit of storage used up by it. The iphone - 1.7gb, ipad 1 - 600 mb... And it all adds up to around 5gb. But what I don't understand is, on 1 of the ipads it says I've used up 17gb of storage (not icloud), so why has the icloud only stored 600 mb of it? Shouldn't it store like the whole 5gb? I really don't know... I need all the info about the icloud. And yes I've read all of it on this website but none of it helps.
    3. Since it say the icloud storage is full, how do i get more storage, should I just buy more, or is there another way?
    All I know is, if I have icloud set up on all 3 of my devices, what ever i buy on 1 devices it goes on the other 3.
    And that, i have a back up with all my music n stuff in, just incase something goes wrong. Please help! Thanks!

    iCloud Support
    http://www.apple.com/support/icloud/
    iCloud Help
    http://help.apple.com/icloud/?lang=en

  • Everyone keeps skipping my question....please help me!

    When a purchased a song on itunes a message came up
    "Error unable to dowload error 450 Please check that the connection to the network is active and try again"
    What does that mean? I stoped the process and then restarted it. It still didnt work. I have payed for it so its not like i'm just gonna forget about it!I then purchased 2 other songs and they downloaded perfectly without any trouble! Whats up with this one song??
    please help me!

    I answered your question in your duplicate post before you posted this.
    Please have patience when you post a question. Everyone here is just a fellow user, helping out as they have time, knowledge and inclination. It's rude to expect someone to answer your question within only a half-hour after you first post, then post again demanding an answer (in particular after someone already answered you). You really need to wait longer - at minimum several hours and better at least a day - and only then if you don't get an answer bump your original thread by posting as a reply to your original post.
    BTW, it also helps if you post in the correct forum. Questions about the iTunes Store are usually best posted in the Using iTunes Store for Windows forum.

  • Lost ALL of my iCal Events -- Please help!!

    I turned on my MacBook Pro today, opened iCal and ALL of my events were gone!
    I checked both calendars, checked all dates in the past and in the future. Checked all the settings, etc. Switched views. Rebooted. Everything that I can think of.
    The only thing that remained were the tasks, but all of the events have magically disappeared. Now I desperately need them! Ugh!
    I thought long and hard about what I may have done to mess up iCal, and I couldn't think of a single thing. I do not synch my Mac with any PDA's or other devices. I did not recently install any applications that might touch iCal data. In short, I have no f-ing clue what happened to my iCal data! And I desperately need it. (And yes, my idiotic a$$ did not back it up.) Argh!
    Does anyone have any clue how to recover my iCal data / troubleshoot this issue?
    Please help.
    Thanks!

    If you are running Time Machine... See here...
    How do I view or restore selected items?
    Video on Restore From Time Machine
    http://support.apple.com/kb/VI29

Maybe you are looking for

  • A/R reserve Invoice as Proforma Invoice

    Hi experts,               I have one doubt in A/R reserve invoice. My Client is using Proforma invoice. They will send this Proforma invoice to their customer to get get Confirmation about the Invoice. Once their Customer, confirms that proforma invo

  • Deleting Photoshop from my computer

    I wanted to delete Photoshop from my computer, but mistakenly I've put it in the trash. now there I can't get rid of it. Can anyone help?

  • TV shows stopping for no reason

    I have a problem with tv shows stopping for no reason on the iPod Touch. First the sound disappears, and then the show stops and I get booted back to the main menu. This has happened with four completely different tv shows. I never had this problem w

  • Compile at runtime. How to???

    Is it possible that program compile the text code at runtime?? For example i type in textArea: class Out{    public static void main(String[] args){       System.out.print("WORKING!!"); }, pressing a COMPILE key and my program compiles the code?? How

  • 4.7 x 2.00 Support Pack Question

    Hello, I am attempting to apply upgrade from PI_BASIS 2004_1_620 to PI_BASIS 2005_1_620 on an R/3 Enterprise 4.7 x 2.00 System.  Using the SAINT tool, I am bringing in the SAPKINBB7A OCS package.  I have tried the following queues: SAPKINBB7A by itse