Double Click Mouse Events

Hi,
I have a JTable which I'm displaying to a set of users. There is a specific function that I want to perform if a user double clicks on any row. However I can't seem to find a way of doing this.
The MouseListener interface only seems to produce events based on single clicks, but I specifically want a double click to generate the required function.
Any ideas ?

No, it doesn't always - although it is supposed to. I always get two single click events when I should get one double-click. I need to detect the double clicks for specific functionality also. I'm wondering if there is a "click-interval" I can set somewhere.
I'm running jdk 1.2.1_04 on Solaris 8. Upgrading to 1.3 or better is not an option at the moment.

Similar Messages

  • How to detect only single click and not double-click mouse events in Swing?

    Hi,
    In my application, I want to implement a functionality only for single click. But problem is on double click, first i can see a single click and then double click.
    i.e e.getCount() return 1 and then 2 for double click. I want to avoid this situation.
    Shouldn't it be just one event with a clickCount of 2? or any alternative solution?
    Please let me know how can i stop this.
    Thanks in advance..
    Cheers
    Somasekhar
    Edited by: SomasekharPatil on Mar 13, 2009 3:36 PM

    Maybe something like the below example:
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.awt.event.MouseAdapter;
    import java.awt.event.MouseEvent;
    import java.awt.event.MouseListener;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.SwingUtilities;
    import javax.swing.Timer;
    public class SingleClickOnly {
        public static void main(String[] args) {
         SwingUtilities.invokeLater(new Runnable() {
             @Override
             public void run() {
              new SingleClickOnly().createGUI();
        public void createGUI() {
         JFrame frame = new JFrame();
         frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         JLabel label = new JLabel("Only acts on a single click");
         label.addMouseListener(createListener());
         frame.add(label);
         frame.pack();
         frame.setLocationRelativeTo(null);
         frame.setVisible(true);
        public MouseListener createListener() {
         return new MouseAdapter() {
             private int clickCount = 0;
             private final Timer timer = new Timer(1000, new ActionListener() {
              @Override
              public void actionPerformed(ActionEvent e) {
                  if (clickCount == 1) {
                   System.out
                        .println("Executing action on click count 1 only");
              timer.setRepeats(false);
             @Override
             public void mouseClicked(MouseEvent event) {
              clickCount = event.getClickCount();
              System.out.println("Clicked: " + clickCount);
              if (clickCount == 1) {
                  if (timer.isRunning()) {
                   timer.stop();
                  timer.start();
    }Piet

  • Double clicking an event doesn't open it

    My mac mini has iphoto '11 version 9.4.3. and I can't seem to open an event. When I click on it the event is highlighted in yellow and I have a little drop down arrow on the lower right that gives me the option to trash or copy it, but that's it.
    On my other macs I can double click an event to see thumbnails, then double click a thumbnail to see the actual photo. I have tried to open photos in events, photo stream, last import, and I have even downloaded photos and can't open them either. I've been through just about every preference setting there is and I'm starting to think I have a broken Iphoto. Suggestions?

    Oh, ha, ok! I just tried to change the mouse settings but didn't get anywhere with that. I'm using a Dynex wireless mouse and it seems the only thing I can change is the tracking and double click speed.

  • 10.8.2 Double-click the event is invalid

    Double-click the event failure , how to restore the system default ?
    Buy Logitech M555B installed logitech Unifying Software and LCC Connection Utility ( can not uninstall , very annoying) , cause a system failure touchpad and mouse double-click , and I would like to ask how to solve ?
    System version : 10.8.2

    Refer to:
    http://h10025.www1.hp.com/ewfrf/wc/document?cc=us&lc=en&dlc=en&docname=c01664444
    and
    http://www.apple.com/support/osx/printingscanning/

  • Double-clicking an event in iPhoto does not show thumbnails

    I set double-click event in preferences - events to shows event photos but still only see one enlarged photo when double-clicking an event.
    I would like to see the thumbnails to better edit, split event photos which are grouped inappropriately for some reason.

    While you have the one large photo displayed Look down to the lower right hand corner of the iPhoto window and slide the little slider to the left until you see then number of thumbnails you want
    LN

  • I double-click on event  to see all the photos in that event displayed, but all I get is 1 large photo on the edit page.  To see the photos in that event, I have to scroll.  Need to be able to work with all the photos in that event, not one at a time.

    I double-click on event  to see all the photos in that event displayed, but all I get is 1 large photo on the edit page.  To see the photos in that event, I have to scroll.  Need to be able to work with all the photos in that event, not one at a time.

    Maybe you need to adjust the zoom slider in the lower left corner of the window?
    Regards
    Léonie

  • When I double click on events the pics does not open. I have to go to edit to get the pic up on the screen. I can not enlarge the photo either. I have tried to rebulid the libary

    I have iPhoto 11.When I double click on an event the pics do not spread out. I just get a yellow frame around the event. This is when I double click with left finger. With right finger option is slideshow. I can not enlage a pic with double click either. I have rebuild the libary but no difference . Can anyone help me please ?

    Sounds like a trackpad issue. Try changing the trackpad's settings.  Post in the appropriate Mac model forum.  If you have a mouse available try it to see if you can get iPhoto to do what you want.  This can narrow down where the problem is.
    OT

  • Can't open folders or emails by double clicking mouse

    I can't open folders or emails by double clicking my mouse. I was using a corded Apple mouse, so I switched to a Logitech cordless optical mouse, still can't open them. I can open my folder with command O, but not email. Any suggestions?

    This worked for me: I trashed my mouse prefs, then restarted, then -- goto System Prefs --> Keyboard/Mouse --> Mouse --> Double-Click Speed: Now move the speed a minimum of one notch below FAST.
    Yesterday I installed a Logitech MX Revolution, cordless mouse and lost the ability to double click with it and with my Mighty Mouse. Resetting the double click speed below FAST miraculously reset.
    All seems OK now.

  • Can't double click on events to edit in iCal

    Hello,
    I upgraded to Lion the other day and am experiencing a problem in iCal.
    (1) When I click on an event to open or edit it, nothing happens. 
    (2) I also cannot add an event with a click either.  (Only with the "+" for the Quick Event tab).
    The top menu options (File/Edit/Calendar/View...) still work, so I can edit or add an event that way, but not by clicking on it.
    Is this a function of iCal in Lion or is something wrong?
    Thanks ahead of time for any help

    I had this same exact issue. Each time I double-clicked a song in iTunes, it would go into 'rename' mode instead of just playing the track. I finally found the cause and fixed the issue. In your System Preferences -> Trackpad settings, adjust your Double-click speed. If it is set high, lower it to the mid-range setting. After doing this, I was able to double-click track after track and they played as expected. In my case, it seems I had the double-click speed set too high and it just wasn't registering correctly. Hope this fixes your issue as well.

  • Google Calendar: can't edit an event 1) when double clicking an event it doesn't open to edit 2) when clicking on a time slot to edit doesn't do anything & more

    I cannot edit calendar events in google calendar. Also when clicking on a time slot to create an event the click gets stuck and it's scrolling to select time slot and the only way to get it unstuck is to reload the page. Other browsers work just fine.

    I cannot edit calendar events in google calendar. Also when clicking on a time slot to create an event the click gets stuck and it's scrolling to select time slot and the only way to get it unstuck is to reload the page. Other browsers work just fine.

  • TableView Column Mouse Double Click

    Hi,
    I have a table view, if a user double clicks a row - I do something. I notice that if I double click on the header of a column, I receive an ActionEvent just as if the user double clicked a row. Single clicks on the header perform sorting as expected.
    Is here a way to see if the double click mouse event happened on the column header?
    Thanks.

    Depends how you set your event, imo there should be a way to give an event to just a row, if you defined your rows and columns some way(I'm not too sure as I don't have much experience with tables yet...)
    row.addEventHandler(mousEvent.ANY, some event);

  • How to handle doubleclick mouse event in java

    i want to handle double click mouse event in java
    i use getClickCount() function
    but i want that on onetime click show othere windows
    and on doubleclick show diif. window
    but problem is that onetime is occuer always if u click doubleclick

    Maybe post some code so we can see what, if anything, you are doing wrong.
    Examing the results of a call to getClickCount() is the correct way to detect a double click.

  • How do I change: when I double click on a day to add a new event it defaults to All Day and Busy

    iCal 5.0.2 (1571) Is there any way to change this? I can't do it in preferences.
    This is a real pain. To make an event for a specific time I have to double click again, uncheck "All Day" and then put in the time for the start of the event. Even then, if I put in the start time, the end time remains at 6:30 PM, so I have to change that too.
    If I really do want an All Day event, why does it sometimes default to Busy, rather than always to Free?
    The old iCal was far superior in this regard; double click once on a day and the add an event dialogue box appears, defaulting to a time close to when you were making the event, and, if my memory serves correct observing the preference I set with respect to default length of the event.
    I'm aware that Command N gets me a new Quick Event, its a bit better in that if the event i enter opens the big "add an event dialogue box", it has defaulted to an hour long event. But, if I click on a day, and then hit Command N, the new event is put in Today, and not the day I had selected. It also defaults to All Day, unless I put in a time for the event in the Quick Event box.  Why would I do that when I know I want to enter info into a number of fields, and doing so is easiest from the big dialogue box. If i don't enter a time in Quick Event, or enter a day, I still have to double click the event that was created by Quick Event to open the big dialogue box, and start fresh entering everything.  So, I find Quick Event's implimentation cumbersome, overall ending up with more keystrokes and clicks to enter the details I normally enter, than the old iCal.
    So, if someone knows how to change the double click behaviour back to the old way, or how to get Quick Event to open the dialogue box on the day i have already selected, any help will be appreciated.
    Also, is there some way to get this feedback to Apple? Support SiteMap doesn't show a link for feedback.
    Thanks
    Ian

    I have sort of the exact same problem. Extremely far away from user friendly
    I have an second issue as well: When I hook off all-day it comes up with an 8 hour event!
    And then if I put in a late start hour it pushes end time to next day due to the 8 hour event suggestion.
    All in all this gives a lot of changes just to enter an event.
    Command N
    I learnt from your input to use this fuction. At least that comes up with a one hour event as default.

  • 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

  • Tracking system events.. Mouse double click / Right click in OS environment

    Hello all,
    I have stored files in my computer which are generated using my application.These files own my application specific file extension. I have registered the file association to windows registry and when each time the file is opened in OS environment (using double click or rignt click on the icon--> open etc.,).. i need to access the file's absolute path in order to open it using my application. How to track those system events (Double clicks, right click--> open etc.,)..can anyone help me out??..
    Thank you in advance!!

    Yeah.. the OS will pass the necessary information. How do my application will receive the parameter?.. That has to be done by my coding.. right??..
    For example, if an .doc file is opened the OS will open MS-Word and how ll the MS-Word get those parameters. In the same way, how can i receive that parameters to my application..?..this is where i am struggling... i use J2SDK1.4.2_11 and Eclipse 3.1.
    Expecting ur response!!
    Thanks in advance!!

Maybe you are looking for

  • Need help with password for signature with Adobe Acrobat X Pro

    Signature password is invalid in the PDF but when I use the same password to access the Adobe Webpage, it works perfectly. Where is the disconnect and how do I create a situation where the signature on the pdf recognizes my password?

  • How can I manually change contrast/brightness/colors?

    I want to simply use some slider to adjust the contrast, brightness, gamma or color balance in my MacBook Pro, but for some reason I'm unable to find it. All I can find is the calibration process, but when I calibrate it "correctly", the screen is a

  • Queryeditor using fields more than once in where clause not possible?

    I have to create a select query with a WHERE clause using a field multiple times. I can't get this to work. For example: SELECT ALL   EMSDTALIB.EMSPPA.PAIDNR,   EMSDTALIB.EMSPPA.PANAAM,   EMSDTALIB.EMSPPA.PAVLTR,   EMSDTALIB.EMSPPA.PATITL,   EMSDTALI

  • Partial Prompts

    I am trying to create a report that prompts a user for a Serial Number... That part is easy enough... but Some of the serial numbers will start with 6767 or 4439 or 2767 etc... The whole serial number would be 6767958343300033232 So I want to have th

  • 5Gigas of "Other" files

    I don't understand what's happening with my iPhone, it has 5 g of "other" files (it was originally music content). And I can't delete them... http://img100.imageshack.us/img100/1461/picture1ab1.png