Solved

Stop  Java Events

Posted on 2000-05-05
4
230 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
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 100 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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

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…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

747 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now