Solved

Dispatching events to the event queue.

Posted on 1997-05-28
3
271 Views
Last Modified: 2010-04-16
I'm trying to generate an event and dispatch it to a component.  However, the only way I can find to do this is to use Component.deliverEvent() or Component.postEvent().  The problem with these functions is that they call Component.HandleEvent() directly.  Instead, I want to queue the event behind any other events currently waiting to be handled by the receivng component.  Is this possible and how do I queue and event?
0
Comment
Question by:dpon
  • 2
3 Comments
 
LVL 6

Expert Comment

by:jpk041897
ID: 1221033
I'm not actualy sure if it will help, but there is some excellent coverage on events at:

http://www.phrantic.com/scoop/Java000.htm

The info on these pages might give you some insight on how to solve your problem.

As an aside, since events can subcalsed, Have you conided writing your own dispatch table?
0
 
LVL 6

Expert Comment

by:jpk041897
ID: 1221034
Have you considered writting your own dispatch handler?
0
 
LVL 1

Accepted Solution

by:
mann061997 earned 100 total points
ID: 1221035
Use a statement similar to the following, e.g. to post a
MouseEvent:

    Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(
      new MouseEvent(myCustomComp,MouseEvent.MOUSE_CLICKED,
                     0,0,-1,-1,2,false));

More info is available at http://www.geocities.com/Athens/7077/Java104.htm
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question