Solved

Disable event

Posted on 2002-07-25
4
247 Views
Last Modified: 2010-03-31
Does any one know how to disable AWT event, or to catch these event before them processed.
Thanks
0
Comment
Question by:semion50
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 86

Accepted Solution

by:
CEHJ earned 25 total points
ID: 7177113
You can call consume() on the event for a localised treatment, but you may want to disable that sort of event before it is even generated - it depends on what you want to do.
0
 
LVL 4

Assisted Solution

by:kylar
kylar earned 25 total points
ID: 7178108
To disable all AWT events (which is a bad idea, since RepaintEvents are kind of needed (to *see* components).. you can create your own event queue like this:

public class EventQueueOverrider extends java.awt.EventQueue{
   static{
        Toolkit.getDefaultToolkit().getSystemEventQueue().push(new EventQueueOverrider());
   }
 
   public void dispatchEvent(AWTEvent event){
      System.out.println("Event caught.. ignoring");
   }

}

if you do that, then all your events will be ignored. You can parse out the events that you really want to stop, like MouseEvents or something, then let the rest pass through to the queue with a call to super.dispatchEvent().

Do some reading on event types and how they're executed first though, since the example I showed you will pull up an empty frame (no paint events get passed...)

Cheers,
Kylar
0
 
LVL 35

Expert Comment

by:girionis
ID: 8952123
No comment has been added lately, so it's time to clean up this TA.

I will leave a recommendation in the Cleanup topic area that this question is:

- split points between CEHJ and kylar

Please leave any comments here within the
next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER !

girionis
Cleanup Volunteer
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
runtime exception 2 50
jboss wildfly 10.1 10 420
jboss 7.1 start up error 1 62
Delphi Firemonkey: if the Sms contain special characters it won't send it 3 64
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

749 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