?
Solved

Stop  Java Events

Posted on 2000-05-05
4
Medium Priority
?
237 Views
Last Modified: 2008-02-26
When a mouse event occur in one JComboBox or other Swing Component, i want to kill the event before do something.

To be more precise, when the JCombo is clicked, droplist is not to be showed.

Thanks
0
Comment
Question by:Guilly
[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 4

Expert Comment

by:adam923
ID: 2781527
//i haven't tried this but it just might work :-)

public class NoMouseJComponent extends JComponent{
   protected void processMouseMotionEvent(MouseEvent e){}
}
0
 
LVL 19

Expert Comment

by:Jim Cakalic
ID: 2781542
By 'kill the event' do you mean you want to intervene in the event dispatching and prevent other listeners from being notified? Somehow abort the handling of the event?
0
 

Author Comment

by:Guilly
ID: 2787499
Edited text of question.
0
 
LVL 2

Accepted Solution

by:
Nevyn earned 300 total points
ID: 2787711
Why use a combo box if you don't want it to drop the list?
However, you may be able to use the consume method of some event classes. However, if the combo box uses event listeners to handle the drop list, it would be processed before ny listeners you can register. Ma need to sub-class JComboBox and intervene in the processEvent method.
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
The viewer will learn how to implement Singleton Design Pattern in Java.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses
Course of the Month8 days, 22 hours left to enroll

764 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