Solved

Stop  Java Events

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

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

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
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…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

691 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