Trying to catch mouse double click

Using come code in the API 1.3 documentation, I created a JList and am trying to catch when a user double clicks on an item in the list. I have the following snippet of code:
public void mouseClicked(MouseEvent e) {
if ((e.getClickCount() == 3) && (e.getSource() == list1)) {
int index1 = list1.locationToIndex(e.getPoint());
System.out.println("Double clicked from the left list on Item " + index1);
When I double click on an item in list1, it prints out the output line twice as in:
Double clicked from the left list on Item 1
Double clicked from the left list on Item 1
How can I get it to run the code only once. I'm not sure why it's running it twice. Any Ideas would be helpful. Thanks....
Matt Menard

I've used similar procedure with success in JDK1.3.1. Without seeing the rest of your code, the only thing left for you to experiment with is to call the consume() method if the count is greater than 1. I did notice that Java mouse event handler leaves much to be desired. For example, the mouseentered and mouseexited events kept getting fired even tho the mouse has entered and never leave.
V.V.

Similar Messages

  • FRM-40735 when mouse double click trigger raised unhandled exceptiORA-01722

    I am using Forms 10g.
    i am writting a procedure in When mouse double click trigger that will display all the values available for ip address from this procedure.
    The procedure is
    DECLARE
    CURSOR cr
    IS
    SELECT LEVEL NUM
    FROM DUAL
    CONNECT BY LEVEL<=(Select max_range from t_ip_address_dtl where category_name=:t_item_cpu.category and block_name =:block_head.block)
    MINUS
    SELECT TO_NUMBER(SUBSTR(IP_address, 12))
    FROM T_item_cpu;
    abc number(4);
    abc1 number(4):=null;
    BEGIN
    FOR rec IN cr LOOP
         abc1 := abc1 || ',' || rec.num;
    END LOOP;
    Message('You can use between these nos: '||abc1);
    Message('You can use between these nos: '||abc1);
    END;
    It is showing this error :-

    Yes bye mistakly i posted ,, due to internet problem..

  • Why can't I minimise itunes with mouse double click?

    why can't I minimise itunes with mouse double click?

    I do not know if you can ..
    Try -
    Command + M .

  • How to capturing Mouse double click action?

    Hi all,
    how can we identify the "mouse double click" action?
    MouseListener has methods for only mousePressed,released,clicked (single).
    Thanks in advance..
    Regards
    Sojan

    Hi,
    Thanks it worked ..
    e.getClickCount() value increases if we keep on clicking on the component, is there anythning wrong by interpreting double click as
    "e.getClickCount() >=2 "?
    Regards
    Sojan

  • Distinguishing b/t two single mouse-click and mouse-double-click

    Hi,
    I am curious to find out how Forms will distinguish between two single when-mouse-click events and a single when-mouse-doubleclick event. Is it simply a timing issue or is there more involved i.e. the 'co-ordinates' of the mouse. Thanks in advance for any opinions given,
    regards,
    Kevin.

    The difference is same as the difference of Apple and Orange.
    Its depends on O/S and event management within OS kernel.
    You can change the timing in Control panel of mouse double click.

  • MOUSE DOUBLE CLICKING

    I have an hp mouse...however it says product of china on the back..It does look like an hp mouse though..
    Anyhow..it's doubleclicking..it's driving me crazy..
    I've had the mouse for a few years..
    It just starting doing this..
    I"m running XP
    It is a USB..with a red light under it...with an optical eye?...Not sure if that's what they call it..
    Please help..Are there drivers I can use to fix this...
    I"m not sure if a windows update..might have done this..
    Many thanks..

    Hi kittylondon,
    I understand your mouse is acting like you are double-clicking even though you are only clicking. Take a look at the following, Troubleshoot mouse double-clicking when you single-click. The document also applies to Windows 7 and Windows Vista, so you will have to make sure you are referencing only the portions that apply to Windows XP. I hope this is of help to you. Best of luck. Have a wonderful day.
    Ryan1216
    I work on behalf of HP
    The advice and opinions given here are my own and not those of HP

  • Usb mouse double click

    Hi,
    Im using fluxbox as window manager and after some upgrades the mouse very often doing double click, if I click only once. On touchpad is all right, so I dont know where is the problem. I tryed change xorg configuration - other protocol and some options, but nothing helped. I also tryed change speed double click, but nothing changed too.
    My xorg config is now:
    Section "InputDevice"
    Identifier "USB Mouse"
    Driver "mouse"
    Option "Device" "/dev/input/mice"
    Option "SendCoreEvents" "true"
    Option "Protocol" "IMPS/2"
    Option "ZAxisMapping" "4 5"
    Option "Buttons" "5"
    EndSection
    generated by hwd
    Thanks for all replies
    edit: I have kernel 2.6.33.4 and before in kernel 2.6.33.3 "mouse bug" was there too.
    Last edited by aivi (2010-05-15 11:47:40)

    edit: So Its not working well, xev show still that I pressed and released twice button, any ideas?
    In blackbox too. Its somewhere else.
    --------So it was by .fluxbox/keys I tried move them somewhere else and restart X and Its working right now. -------
    Last edited by aivi (2010-05-15 13:25:12)

  • Mouse double click on single click

    My mouse has been double clicking on a single click since changing to Mavericks 10.9. I have tried different mouse brands from Apple to Rapoo and everything inbetween. I have played with the mouse settings and rebooted, reset the pram and nothing works. It's very frustrating as a graphic designer to be slowed down because of a mouse.
    Has anyone ad this problem and has the solution to it?
    Thanks

    From the menu bar click on Go > (Hold option down) Library will appear, click it.
    In the Library goto Preferences
    Locate the following files and delete them.
    -com.apple.driver.AppleBluetoothMultitouch.mouse.plist
    Restart the computer and test.
    Hope this helps.

  • Mouse double click??

    i cant figure out any way by which i can trap the double click
    also, how do i test which mouse button has been clicked??
    is there any class or inbuilt java functionality which lets me to the above mentioned tasks.......plz let me know

    Here's a demo;-import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class ButtonListeners{
       public static void main(String []args){
           new ButtonListeners().new ButtonFrame().show();
       class ButtonFrame extends JFrame{
          JLabel message = new JLabel(" ");
          private ButtonFrame(){
             setTitle("2 x click demo!");
             JPanel panel = new JPanel();
             getContentPane().add(message, BorderLayout.NORTH);
             getContentPane().add(setupPanel(panel), BorderLayout.CENTER);
             setDefaultCloseOperation( EXIT_ON_CLOSE );
             pack();
             setLocation(300, 200);
          private JPanel setupPanel(JPanel panel){
             panel.setLayout(new GridLayout(5,2));
             JButton []button = new JButton[10];
             for(int i=0; i<button.length; i++){
                button[i] = new JButton("button "+(i+1));
                button.addMouseListener(new RightClicker());
    panel.add(button[i]);
    return panel;
    class RightClicker extends MouseAdapter{
    String str;
    boolean doubleClick;
    public void mouseClicked(MouseEvent me){
    boolean clicker=true;
    JButton b = (JButton) me.getSource();
    if (me.getClickCount() == 2) doubleClick = true;
    while(clicker){
    try{
    Thread.sleep(300);
    if(doubleClick)message.setText(" - Double click "+b.getText());
    else message.setText(" ");
    doubleClick=clicker=false;
    }catch(InterruptedException ie){}
    } // while

  • Magic Mouse: Double-click function

    I have "secondary-click"(right) activated on the "magic mouse" and it's great if I want to open a drop-down list on a page.
    However, on the "mighty-mouse" which I had before, the "right-click" was set up to act as a "double-click" which was very handy for opening documents and folders etc.
    Is there any way to set up the "magic-mouse" so that a "right-click" will act as a "double-click"?

    You could try a third-party driver like BetterTouchTool (http://blog.boastr.net/?page_id=1722)

  • In Yosemite, Magic Mouse double-click function doesn't work

    On my iMac running Yosemite 10.10.2, the double-click function on the Magic Mouse no longer works. So to open a folder, or anything for that matter, I must always do click-control ---and that doesn't work for everything. For example, I can't double click on a character in Glyphs, so this renders Glyphs useless. And so on... I have gone into preferences to see if anything was amiss in the settings, but everything checked out fine. Is there a fix for this, or do I have to wait for the next upgrade for Yosemite? Help! Thanks... --Royce

    What's the answer to this mouse problem, please? Why does my double-click no longer work on my magic mouse since downloading Yosemite 10.10.2 to my iMac? 
    What's up Apple?
    Mark

  • Speed of mouse double click controls also finder

    I was wondering why my new macbook pro responded slower than my imac. Then I came across this:
    When I single-click on a folder that I haven't opened for weeks. The time that it takes the finder to show the content of a folder is affected by the setting for 'double-click-speed'.
    For some reason setting the 'double-click-speed' for the mouse to slow also slows down the speed of 'traveling' through the finder. And setting it to fast speeds up the time of going to the next level in the index.

    This is a well known Leopard Finder "Column View" bug - with your post count, I'm surprised you don't recognize the description.
    Send feed back or a bug report (for all the good that seems to do for "Finder" bugs).
    http://www.apple.com/feedback/macosx.html
    http://developer.apple.com/bugreporter/
    yada.

  • JTable & mouse double-click?

    hi,
    When I double-clicked a row in a JTable ,how can i get one column's value in that row.how can i do with the mouse event.
    some examples are preferred.
    thankx in advance !
    rain

    When you say "one column's value in that row" do you mean that you want the value that the user double-clicked?
    When you receive a mouse event, get the selected rows and columns from the table, then get the value from the table model using the getValueAt() method.
    int[] selectedRows = table.getSelectedRows();
    int[] selectedCols = table.getSelectedColumns();
    String selectedElement = (String)model.getValueAt(selectedRows[0], selectedCols[0]);
    System.out.println(selectedElement + " selected");

  • Doubt - mouse double click invokes both single and double click

    Hi Friends,
    I added mouse listener to a java component. In the mouseClicked() method, I have implementation for both mouse single and double click. When I try to double click that component it invokes the single click method first and the it invokes the double click method. My problem is when I try to double click that component it should invoke my double click method alone not single click too.
    I'd be very grateful if someone can help me.
    Thanks and Regards,
    Sangeetha J

    Your problem: a double click is two single clicks. The first click will always fire a single-click event. How's the computer supposed to know that another click is to follow?
    All I think you could do is to instantiate a timer in the one-click method, set to whatever amount of time you think a double-click should take. If you get a second event while the timer's still active, it was a double-click and you can stop the timer and do the double-click action. Otherwise your timer should execute the single-click action after it timed out.
    But this will make your GUI look like it's responding slowly to single-clicks.

  • Mouse double click event

    hi
    im really new to programming,
    i have a jlist populated from ms-access,i just want to capture a event only when the item is double
    clicked.
    can anybody please get me the code for capturing the data only when the mouse is double clicked.
    -thanks

    Hope this will helps to you.
                              public void mouseClicked(MouseEvent e) {
              if(e.getClickCount() == 2)          {
                   JOptionPane.showMessageDialog(null,"Double click captured");
         }Thanks

Maybe you are looking for

  • Report to see and send as e-mail of all open Complaints/transactions

    Hello Gurus, We need to view all the Open Service Transactions/Incidents (we have a Ztransaction type) for the past 3 months and send that output as an attachment to our Service Manager's e-mail address for him to action on. Is there a standard way o

  • Reading CSV on Unix

    Hi, I want to read a CSV file that is in a folder in UNIX box. I dont have an ODBC DSN , how can I read it ? Thanks in Advance Jyoti

  • WRT610N FTP Administration: Limited Options

    I'm wondering if there's a way go get more options for FTP administration, or if there's someone I can contact for feature requests.  Basically, while an FTP server is quite a useful feature, the administration options are very limited, especially fo

  • Purge Cache from Admin tool

    Hi Experts, I am using security filters for groups. I am devolving my S&V. when ever I am changing my conditions it is not reflecting. I think I have issue with cache. When ever I am taking query from log always where condition is showing previous ta

  • Defining hierarchy level keys

    Hi, What is the best practice regarding the level keys (used in the hierarchy level for dimensions)? I had a problem with the numbers shown because the level key contained values with a mix of letters and numbers. If the level key only contains lette