[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Stop  Java Events

Posted on 2000-05-05
4
Medium Priority
?
240 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 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
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…
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:
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Suggested Courses
Course of the Month18 days, 6 hours left to enroll

829 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