Help! How to capture a single double click???

I want to caputre mouse double click as well as single click,
and I used MouseAdapter.mouseClicked(MouseEvent)
and use MouseEvent.getClickCount() to check click count,
but I found that every double click will cause a single click event first,
then a double click event,
but I only want to capture a single double click,
how can I do that??
Thansk!!!

if(MouseEvent.getClickCount() larger than 1) {
  // process double click
else {
  // process single click
}*the larger than sign is not rendered here                                                                                                                                                                                                                                                                                                                                               

Similar Messages

  • Single/Double click in Design Studio Dashboard

    Hi All
    In my design studio dashboard, have enabled a functionality of jump-to from one cross tab to other. When doing a single click on a particular value say network - Jim as shown below it jumps to next table showing the relevant confirmation values. But the same thing when a double click is done instead of showing the relevant confirmation values for network - Jim, it displays all the available confirmation values.
    Single click view:
    Double click view:
    Is there a way to handle this? Like switch off single/double click or any scripting to control this?
    Any suggestions highly appreciated.
    Regards
    Merlin

    Hi Patrick
    If i try the solution suggested by Deepu, on a fresh dashboard it works perfectly fine.
    But the same when i do it on my existing dashboard, it does not gives me the expected results. Not only this many other features have resulted in similar situation . I end up kind of refreshing each and every component, thats a lot of re-work
    Guess the refresh doesnt happen properly in design studio.
    Thanks
    Merlin

  • How to handle a button double click

    I know how to define and IBAction and link it to a control by (Click-Drag)ing.
    But that does not make me chose what action (event for x-Microsoft) in the control am I linking to.
    By other words, when I click-drag, I dont mention, anywhere that I want this action to be linked to the "Click" event of a button. So what if I want this action method to be called when a button is double clicked for example, or when the mouse moves over it.
    Thanks

    Hi Tony, and welcome to the Dev Forum!
    The good news is Apple provides thorough documentation on tracking, interpreting and handling Cocoa mouse events. The bad news is the info is carved into pieces that are scattered all over the library. The challenge is to identify the docs that contain one or more pieces of the puzzle, and then to fit everything together.
    As to double clicks, there's no NSControl equivalent to the double-click notification that many Windows controls send (e.g. BN_DOUBLECLICKED). Also, as you've seen, when connecting an event to an action method in IB, there's only one event to choose from (Cocoa Touch is different in this regard, btw. You'll have a choice of several events when connecting a UIControl object to an action method in IB, though "double-touch" isn't among them).
    So how do Cocoa programmers detect a double click in, for example, an NSButton? The default action message for this class is generated by a NSLeftMouseUp event. I.e. when the left button is released while the control is tracking the cursor.
    One crude but effective solution is to have the listener (the action method connected to the button) set an ivar and start a one-shot timer on the first message. If a second message is received before the timer method resets the ivar, we have a double click. Otherwise we have two single clicks.
    A more general solution is based on two methods you might easily overlook. Firstly, [setContinuous:|http://developer.apple.com/mac/library/documentation/Cocoa/Refe rence/ApplicationKit/Classes/NSCellClass/Reference/NSCell.html#//appleref/doc/uid/20000074-BBCCCEAA] allows you to configure the associated NSActionCell object to send a stream of messages to the button's target instead of just one. The stream starts with the mouse down event that initiated tracking and ends with the mouse up that ends tracking (also see [trackMouse:inRect:ofView:untilMouseUp:|http://developer.apple.com/mac/library/ documentation/Cocoa/Reference/ApplicationKit/Classes/NSCellClass/Reference/NSCell.html#//appleref/doc/uid/20000074-BBCCJAFJ]).
    The next piece of the puzzle is the [currentEvent|http://developer.apple.com/mac/library/documentation/Cocoa/Refere nce/ApplicationKit/Classes/NSApplicationClass/Reference/Reference.html#//appleref/occ/instm/NSApplication/currentEvent] method of NSApplication. This returns the NSEvent object the started the current event cycle, i.e., the event which caused NSButton to send the current action message.
    Thus the listener has access to the stream of event objects which represents the mouse activity from the start of tracking to the end. Using the position and time stamp data from this stream, the listener can distinguish between clicks and drags (hovering is detected differently; I won't try to cover that topic in this post).
    A couple reference links that might help with the rest of the puzzle:
    [Handling Mouse Events|http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/Ev entOverview/HandlingMouseEvents/HandlingMouseEvents.html#//apple_ref/doc/uid/100 00060i-CH6-SW1]
    [Control and Cell Programming Topics for Cocoa|http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/Con trolCell/ControlCell.html#//apple_ref/doc/uid/10000015i]
    Hope that helps!
    \- Ray

  • How to make response to double click of mouse event

    could anyone give me some hints? I wanna a component to respond to a double click.But it triggers by single click,how to solve this problem?

    Hello,
    Let's say that 'c' is your component, you should have a code such as this one :
    c.addMouseListener(new MouseAdapter() {
       public void mouseClicked(MouseEvent e) {
          if (e.getClickCount() == 2) {
             // you have a double click on c
    });

  • How to trigger event when double click on a tree node

    I have this code which creates new tab in a remote Java Class.
    treeView.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<TreeItem<String>>()
       @Override
       public void changed(ObservableValue<? extends TreeItem<String>> observable, TreeItem<String> oldValue, TreeItem<String> newValue)
       System.out.println("Selected Text : " + newValue.getValue());
       // Create New Tab
       Tab tabdata = new Tab();
       Label tabALabel = new Label("Test");
      tabdata.setGraphic(tabALabel);
       DataStage.addNewTab(tabdata);
    Can you tell me how I can modify the code to open new tab when I double click on a tree node. In my code the tab is opened when I click once. What event handler do I need?

    import java.util.Arrays;
    import javafx.application.Application;
    import javafx.event.EventHandler;
    import javafx.stage.Stage;
    import javafx.scene.Scene;
    import javafx.scene.input.MouseEvent;
    import javafx.scene.layout.StackPane;
    import javafx.scene.control.TreeCell;
    import javafx.scene.control.TreeView;
    import javafx.scene.control.TreeItem;
    import javafx.scene.control.SelectionMode;
    import javafx.util.Callback;
    public class TreeTest extends Application {
      public static void main(String[] args) {
        launch(args);
      @Override
      public void start(Stage primaryStage) throws Exception {
        primaryStage.setTitle("TreeView Test");
        primaryStage.setScene(createScene());
        primaryStage.show();
      private Scene createScene() {
        final StackPane stackPane = new StackPane();
        final TreeView<String> treeView = new TreeView<String>();
        treeView.setRoot(createModel());
        treeView.getSelectionModel().setSelectionMode(SelectionMode.SINGLE);
        treeView.setCellFactory(new Callback<TreeView<String>, TreeCell<String>>() {
          @Override
          public TreeCell<String> call(TreeView<String> treeView) {
            return new ClickableTreeCell();
        stackPane.getChildren().add(treeView);
        return new Scene(stackPane);
      private TreeItem<String> createModel() {
        TreeItem<String> root = new TreeItem<String>("RootNode");
        TreeItem<String> packageA = new TreeItem<String>("package A");
        packageA.getChildren().addAll(
            Arrays.asList(new TreeItem<String>("A1"), new TreeItem<String>("A2"), new TreeItem<String>("A3"))
        TreeItem<String> packageB = new TreeItem<String>("package B");
        packageB.getChildren().addAll(
            Arrays.asList(new TreeItem<String>("B1"), new TreeItem<String>("B2"), new TreeItem<String>("B3"))
        root.getChildren().addAll(Arrays.asList(packageA, packageB));
        return root;
      private class ClickableTreeCell extends TreeCell<String> {
        ClickableTreeCell() {
          setOnMouseClicked(new EventHandler<MouseEvent>() {
            @Override
            public void handle(MouseEvent event) {
              // Handle double-clicks on non-empty cells:
              if (event.getClickCount()==2 && ! isEmpty()) {
                System.out.println("Mouse double-clicked on: " + getItem());
        @Override
        protected void updateItem(String item, boolean empty) {
          super.updateItem(item, empty);
          if (empty) {
            setText(null);
          } else {
            setText(item);

  • I have both Photoshop 4 and Photoshop 6 on my computer. When I am in Bridge and want to open an image by double clicking, it automatically opens in 6. I see, when I go to "open with" 6 is listed as "default" How can I change the "double click" defult to o

    I have both Photoshop 4 and Photoshop 6 on my computer. When I am in Bridge and want to open an image by double clicking, it automatically opens in 6. I see, when I go to "open with" 6 is listed as "default" How can I change the default to open an image with a double click in 4?

    You can associate files from the Bridge level and the Desktop level.
    In Bridge CS4, go to Preferences > File Type Associations and change it to Photoshop CS4 for the file types you want.
    If you want to open files from the Windows Desktop in CS4, these are the instructions:
    Do this from the Windows Desktop:
    If you want your image file to open in Photoshop and it doesn't, right click on it and choose
    Open with > Choose default program… select Photoshop CS4 or CS6 and checkmark "always use the selected program to open this type of file".

  • How Do I Adjust the Double-Click Speed in 10.8.3

    Hi. I only found this to adjust the double click speed for Lion http://support.apple.com/kb/ht4930
    but how do you adjust it if your Lion's version is 10.8.3?
    Thank you for your time.
    Have a great sunday & a nice sunday mass.
    God bless.

    For 10.8.3,  it's in System Preferences > Accessiblity > highlight Mouse & trackpad on the left.  The Double click speed slider shows on the right.  Moving it to the left gives you more time between clicks.  Moving it right gives you less time.

  • How can I change/hack double-click behavior to include a preceding dollar symbol in the selection?

    99.999% of times I double-click a word preceded of a $ (dollar) symbol, it is a variable name, and I want to COPY it along with the word, so I don't have to re-type it when pasting it.
    Even in preview mode / visual view / when typing into actual text, I can't imagine a scenario where the dollar sign would not be part of the following word.
    Is there any way to make this dumb behavior smarter?
    Hacking into the DW files? Hacking into MacOS files?
    Thanks.

    epub is a specific format that may require another app - I don't know what that would be on 10.5.
    You can get info on the file in Finder (select the file, choose File Menu > Get Info…) the 'Open with' section will allow you to select other apps & you can also change this file & apply it to all files of that kind.
    That should solve your issue, but you still may need an ebook reader.

  • How can I turn off double click to import files in the bin?

    When navigating big lists of files I always tend to miss a few files when clicking them and then get the very annoying import box to pop up. Can this be turned off? How?
    I'm on Premiere Pro CS6 for mac

    1. Improve your mouse's aim.
    =or=
    2. Get used to using the 'Esc' key.
    =and, or=
    3. Make a feature request:
    http://www.adobe.com/go/wish

  • Help!!! I think my email was hacked and now I can't get into it at all. All of the suggestions didn't help so far. I have double clicked, rebooted, and deleted the account. Is there a way that I can have a reset password to an alternate email?

    Help, my email was hacked, now I can't get in at all. Can I reset the password through an alternate email?

    You do realize that there are many, many email providers and without knowing which one you are talking about, there is no way to answer your question?
    Which then leads to this ..... Have you contacted your email provider about this? That's probably the best place to start. See what they recommend.

  • Subject:  How to code double-click to launch hyperlink in AppleScripts

    Subject:  How to code a mouse double-click to launch a hyperlink in a web site  from inside AppleScripts
    Hello,
    I am trying to code my repetitive tasks.  I log into a destination web site and to gather information on a specific stock ticker, forexample APPl.
    My existing code works successfully up to the point o fwhen I locate a "view" hyperlink I wish to run i.e.... double click on the hyperlink with the mouse.
    I have been surfing the web, books, etc trying to figure out how to send  click click as it were as keystrokes to launch the hyperlink.
    I am unable to locate the information I need.  I cannotbe the first person to launch a script that searches for the "generic" target and once the desired target is highlighted, I wish to launch the hyperlink that it has successfully located.  The finder dialogue appears and successfully finds several matches for the <target>.   I enter keystroke enter once, to get to the specific hyperlink I want to launch but can not figure out how to pass"click" "click"  or "dblclick" to the website hyperlink in AppleScript to automate this relative task, that will ultimatley launch the hyperlink sending me to the next web site in a PDF format that displays info I want to access.
    If you would please help me to pass the desired mousebutton double click that will launch the hyperlink while inside theAppleScript.
    Many thanks in advance for a sucessful resolution.
    Example code if I am not clear in my explanation above.
    tell application"Safari"
             activate
             make new document
             setURL of document offirst window to "https://store.apple.com/us"
             delay 2
             tellapplication "System Events"
                      tellapplication process"Safari"
                               delay 2
                               keystroke "f" using {command down}
                               delay 2
                               keystroke"MacBook Air"
                               keystroke (ASCIIcharacter 13)
                               --Nowthat I have found the 3 matches of "MacBookAir"
                               --I Want to select and launch the second match of"MacBook Air"
                               -- How can I  send dblclick to the hyperlink (secondmatch of "MacBook Air") which is highlighted to launch the hyperlink?
                           --How do I send click click to be passed to thehyperlink here in the AppleScript
                      endtell
             endtell
    end tell

    Why not try the sample script I posted and see why I need the doublle click to launch the hyperlink.
    I have tried your sample script and consider myself extremely lucky to have found a way to click (just once) the highlighted hyperlink after many trials and errors :
    tell application "Safari"
        activate
        make new document
        set URL of document of first window to "https://store.apple.com/us"
        delay 2
        tell application "System Events" to tell process "Safari"
            keystroke "f" using {command down}
            delay 2
            keystroke "MacBook Air"
            keystroke (ASCII character 13)
            delay 2
            click at position of window 1 -- the yellow highlight rectangle, not the Safari window
        end tell
    end tell
    I totally agree with Camelot when he says that “it's incredibly difficult to drive web pages via UI actions”. The above solution might work only with a few web pages.

  • My double click isn't working for itunes to choose songs ? how can i get it working ?

    ever since i got my macbook pro my double clicking hasnt been working on itunes to choose songs, so in stead i have to use arrow keys. how do i get my double click working again ?

    Is it working normal in the Mac system?
    Tried clicking a little bit faster, or a little bit slower than normal?

  • Help! Can't use double click to open!

    I need some help here. I can't double click to open anything on my computer. Not my HD, or anything in my HD. The only way I can open my HD is to click on my HD icon then go to File-Open. And to open anything in my HD I have to click on the item and then go to File-Open. I can double click open iPhoto, but once I'm in iPhoto I can't double click any photos to open them. Instead I have to click on the photo and then click edit.
    Can someone please help?
    TIA!

    Okay, I did a search here and think I fixed it.
    Went to Apple Menu-Preferences-Keyboard & Mouse-Mouse. Drop down=Dashboard. Left side Drop Down=Primary button and Right side Drop Down=Secondary button and Expose=All Windows and Scrolling Options=Vertical & Horizontal.
    Hope this helps someone!

  • How do I double click in the playbook's browser?

    Hello World,
    I am trying to use a web page that requires me to double-click.  The PB browser zooms if I double-tap.  How do I send a double-click instead?
    Thanks
    Solved!
    Go to Solution.

    Maybe you can post a link to the page and tell us what you are trying to double click.
    A website that asks you to double click has obviously been written when most visitors had windows pc. It is asking you to execute or open something.  take care!
    Right click is tap and hold. A context menu will open and it will vary.
    Double click is as skidoo says,  or tap, wait, tap, or tap and hold then Open in new tab. It really depends on what the link is.

  • How do I adjust double click speed in Mountain Lion. The mouse system preferences does not seem to have a speed slider for double clicking. Only the tracking speed slider is visible.

    Double clicking is no longer opening my folders.
    How can I adjust the double click speed in Mountain Lion to reduce the double clicking speed. The mouse system preferences does not seem to have a speed slider for double clicking. Only the tracking speed slider is visible.

    For 10.8.3,  it's in System Preferences > Accessiblity > highlight Mouse & trackpad on the left.  The Double click speed slider shows on the right.  Moving it to the left gives you more time between clicks.  Moving it right gives you less time.

Maybe you are looking for

  • How can I reduce wind noise in Final Cut Pro X?

    The footage has been shot.  I used a Sony HDR-SR12 for the footage.  We were shooting outside in what was almost a wind tunnel it seemed. I have only just started into FCPx with no other experience.  The only other production software I have is Garag

  • Acrobat Pro XI . converting of excel and word to pdf

    After installing Acrobat Pro XI two days ago, the conversions of excel and word to pdf are less than optimal.  Poor fonts, color and sometimes blurry.

  • Printing logo in smartform

    Hi all, I've embedded a logo (background color is white) in tif format in a smartform. When I print it out with printer A, it looks perfect. But strangely, when I print it out with printer B, the logo's background color becomes dark. I just want to m

  • Allocations in BPS

    Hi Gurus, I have a requirement to use the Allocation function in BPS for our Budget process. I have never used this function before. What I need to do is allocate from Sender Cost Center to Receiver Cost Center based on a Secondary cost elements . Fo

  • Hello....unable to install flash player on internet explorer 10

    please provide assistance to installing flash player on internet explorer 10... message states please close the following program... internet explorer (installation stop at 50%.