Disable a double mouse click...

Can anyone show me how to disable a double left mouse click.

just add a mouselistener to the component you want to stop it, and this will trap the mouse clicks for you.
the api docs describe the listener more fully http://java.sun.com/j2se/1.4/docs/api/java/awt/event/MouseListener.html

Similar Messages

  • Double Mouse Click

    Good afternoon, I'm an Adobe Captivate's user and I need some
    informations about the object "Click Box". When we use the option
    "Duble Mouse Click", here in my job, it's not working. Does it need
    another configuration to function? I need some aid. Thanks,
    Caroline Reis.

    I'm seeing the same issue.  I've put in a bug report for it.  Someone suggested that it happens with AS3, and that may be the case, since it only happens sometimes for me, but always in Captivate 5, which only has AS3.
    To clarify - it expects a double click (a single click doesn't work), but when you double click, the slide moves ahead, but the second click registers as an error on the next slide, and brings up the failure caption.
    This link suggests the source of the problem.
    http://www.charglerode.com/blog/?p=54

  • The Hyperlinks and even the active buttons(like Back, Forward, Maximize,minimize,closeetc) on a webpage opened on Firefox page become inactive and there is no action on mouse click on them.

    == Issue
    ==
    I have another kind of problem with Firefox
    == Description
    ==
    I use Firefox Version 3.6.6. If firefox is kept opened for a day or two with some tabs opened, then the active buttons like the "Back","Forward","Maximize","minimize","Close", etc and even the links on the webpage become disabled. On mouse click no action gets performed on these type of links. Once this starts only a PC restart causes Firefox to work normally.
    Please kindly help me with a solution and I would request a fix for this issue.
    == This happened
    ==
    A few times a week
    == Firefox is kept opened for long time, may be for a day or two with quite a lot of tabs opened.
    ==
    == Troubleshooting information
    ==
    Application Basics
    Name Firefox
    Version 3.6.6
    Profile Directory
    Open Containing Folder
    Installed Plugins
    about:plugins
    Build Configuration
    about:buildconfig
    Extensions
    Name
    Version
    Enabled
    ID
    Google Redesigned 0.4.5 false
    Greasemonkey 0.8.20100211.5 false
    Java Console 6.0.16 true
    Java Console 6.0.17 true
    Java Console 6.0.20 true
    Java Quick Starter 1.0 false [email protected]
    Microsoft .NET Framework Assistant 1.1 false {20a82645-c095-46ed-80e3-08825760534b}
    New Tab King 3.1.4 false
    RealPlayer Browser Record Plugin 1.1.1 false
    Stylish 1.0.8 false {46551EC9-40F0-4e47-8E18-8E5CF550CFB8}
    Modified Preferences
    Name
    Value
    accessibility.typeaheadfind.casesensitive 1
    accessibility.typeaheadfind.flashBar 0
    browser.places.smartBookmarksVersion 2
    browser.startup.homepage_override.mstone rv:1.9.2.6
    extensions.lastAppVersion 3.6.6
    general.useragent.extra.microsoftdotnet (.NET CLR 3.5.30729)
    network.cookie.prefsMigrated true
    print.print_printer \\secureprint\Level 8 Right Wing Printer
    print.printer_\\secureprint\Level_8_Left_Wing_Printer.print_bgcolor false
    print.printer_\\secureprint\Level_8_Left_Wing_Printer.print_bgimages false
    print.printer_\\secureprint\Level_8_Left_Wing_Printer.print_command
    print.printer_\\secureprint\Level_8_Left_Wing_Printer.print_downloadfonts false
    print.printer_\\secureprint\Level_8_Left_Wing_Printer.print_edge_bottom 0
    print.printer_\\secureprint\Level_8_Left_Wing_Printer.print_edge_left 0
    print.printer_\\secureprint\Level_8_Left_Wing_Printer.print_edge_right 0
    print.printer_\\secureprint\Level_8_Left_Wing_Printer.print_edge_top 0
    print.printer_\\secureprint\Level_8_Left_Wing_Printer.print_evenpages true
    print.printer_\\secureprint\Level_8_Left_Wing_Printer.print_footercenter
    print.printer_\\secureprint\Level_8_Left_Wing_Printer.print_footerleft &PT
    print.printer_\\secureprint\Level_8_Left_Wing_Printer.print_footerright &D
    print.printer_\\secureprint\Level_8_Left_Wing_Printer.print_headercenter
    print.printer_\\secureprint\Level_8_Left_Wing_Printer.print_headerleft &T
    print.printer_\\secureprint\Level_8_Left_Wing_Printer.print_headerright &U
    print.printer_\\secureprint\Level_8_Left_Wing_Printer.print_in_color true
    print.printer_\\secureprint\Level_8_Left_Wing_Printer.print_margin_bottom 0.5
    print.printer_\\secureprint\Level_8_Left_Wing_Printer.print_margin_left 0.5
    print.printer_\\secureprint\Level_8_Left_Wing_Printer.print_margin_right 0.5
    print.printer_\\secureprint\Level_8_Left_Wing_Printer.print_margin_top 0.5
    print.printer_\\secureprint\Level_8_Left_Wing_Printer.print_oddpages true
    print.printer_\\secureprint\Level_8_Left_Wing_Printer.print_orientation 0
    print.printer_\\secureprint\Level_8_Left_Wing_Printer.print_pagedelay 500
    print.printer_\\secureprint\Level_8_Left_Wing_Printer.print_paper_data 1
    print.printer_\\secureprint\Level_8_Left_Wing_Printer.print_paper_height 11.00
    print.printer_\\secureprint\Level_8_Left_Wing_Printer.print_paper_size_type 0
    print.printer_\\secureprint\Level_8_Left_Wing_Printer.print_paper_size_unit 0
    print.printer_\\secureprint\Level_8_Left_Wing_Printer.print_paper_width 8.50
    print.printer_\\secureprint\Level_8_Left_Wing_Printer.print_reversed false
    print.printer_\\secureprint\Level_8_Left_Wing_Printer.print_scaling 1.00
    print.printer_\\secureprint\Level_8_Left_Wing_Printer.print_shrink_to_fit true
    print.printer_\\secureprint\Level_8_Left_Wing_Printer.print_to_file false
    print.printer_\\secureprint\Level_8_Left_Wing_Printer.print_unwriteable_margin_bottom 0
    print.printer_\\secureprint\Level_8_Left_Wing_Printer.print_unwriteable_margin_left 0
    print.printer_\\secureprint\Level_8_Left_Wing_Printer.print_unwriteable_margin_right 0
    print.printer_\\secureprint\Level_8_Left_Wing_Printer.print_unwriteable_margin_top 0
    print.printer_\\secureprint\Level_8_Right_Wing_Printer.print_bgcolor false
    print.printer_\\secureprint\Level_8_Right_Wing_Printer.print_bgimages false
    print.printer_\\secureprint\Level_8_Right_Wing_Printer.print_command
    print.printer_\\secureprint\Level_8_Right_Wing_Printer.print_downloadfonts false
    print.printer_\\secureprint\Level_8_Right_Wing_Printer.print_edge_bottom 0
    print.printer_\\secureprint\Level_8_Right_Wing_Printer.print_edge_left 0
    print.printer_\\secureprint\Level_8_Right_Wing_Printer.print_edge_right 0
    print.printer_\\secureprint\Level_8_Right_Wing_Printer.print_edge_top 0
    print.printer_\\secureprint\Level_8_Right_Wing_Printer.print_evenpages true
    print.printer_\\secureprint\Level_8_Right_Wing_Printer.print_footercenter
    print.printer_\\secureprint\Level_8_Right_Wing_Printer.print_footerleft &PT
    print.printer_\\secureprint\Level_8_Right_Wing_Printer.print_footerright &D
    print.printer_\\secureprint\Level_8_Right_Wing_Printer.print_headercenter
    print.printer_\\secureprint\Level_8_Right_Wing_Printer.print_headerleft &T
    print.printer_\\secureprint\Level_8_Right_Wing_Printer.print_headerright &U
    print.printer_\\secureprint\Level_8_Right_Wing_Printer.print_in_color true
    print.printer_\\secureprint\Level_8_Right_Wing_Printer.print_margin_bottom 0.5
    print.printer_\\secureprint\Level_8_Right_Wing_Printer.print_margin_left 0.5
    print.printer_\\secureprint\Level_8_Right_Wing_Printer.print_margin_right 0.5
    print.printer_\\secureprint\Level_8_Right_Wing_Printer.print_margin_top 0.5
    print.printer_\\secureprint\Level_8_Right_Wing_Printer.print_oddpages true
    print.printer_\\secureprint\Level_8_Right_Wing_Printer.print_orientation 0
    print.printer_\\secureprint\Level_8_Right_Wing_Printer.print_pagedelay 500
    print.printer_\\secureprint\Level_8_Right_Wing_Printer.print_paper_data 1
    print.printer_\\secureprint\Level_8_Right_Wing_Printer.print_paper_height 11.00
    print.printer_\\secureprint\Level_8_Right_Wing_Printer.print_paper_size_type 0
    print.printer_\\secureprint\Level_8_Right_Wing_Printer.print_paper_size_unit 0
    print.printer_\\secureprint\Level_8_Right_Wing_Printer.print_paper_width 8.50
    print.printer_\\secureprint\Level_8_Right_Wing_Printer.print_reversed false
    print.printer_\\secureprint\Level_8_Right_Wing_Printer.print_scaling 1.00
    print.printer_\\secureprint\Level_8_Right_Wing_Printer.print_shrink_to_fit true
    print.printer_\\secureprint\Level_8_Right_Wing_Printer.print_to_file false
    print.printer_\\secureprint\Level_8_Right_Wing_Printer.print_unwriteable_margin_bottom 0
    print.printer_\\secureprint\Level_8_Right_Wing_Printer.print_unwriteable_margin_left 0
    print.printer_\\secureprint\Level_8_Right_Wing_Printer.print_unwriteable_margin_right 0
    print.printer_\\secureprint\Level_8_Right_Wing_Printer.print_unwriteable_margin_top 0
    privacy.sanitize.migrateFx3Prefs true
    security.warn_viewing_mixed false
    == User Agent
    ==
    Opera/9.80 (Windows NT 5.1; U; en) Presto/2.5.24 Version/10.54

    I do not use McAfee software and I am having this issue. I can right-click on the "back-or-forward" buttons and get a history list to choose from (which is far from an improvement), but do not get any response from a left-click. The "back-or-forward" navigation buttons are greyed-out. Also, when I open Firefox (4), I get two title bars at the top with two separate sets of the "minimize", "maximize" and "close" icons. It appears as if one window is open within another, but if I click any of the commands "both" windows respond. It's annoying and cumbersome.

  • Use mouse click trigger option more than once?

    Hi, is there some way to use the "mouse click" trigger option more than once in the project? I am trying to build a menu button animate where the users click the (menu grid icon) once, and it transforms into the (x icon) and stays there until they click it again ONCE to change it back to the (menu grid icon). Other trigger actions aren't ideal, and I find that if I used the "double mouse click", the response gets a bit messy as clicking once would replay the whole sequence again. Thanks!

    At CreationComplete make a var as:
    button = -1;
    At click event of the button write:
    if (button == -1){
    sym.getSymbol("nmnmnmn").play("xicon");   // if you have a trigger in timeline to make this action that you want
    button++;
    else {
    sym.getSymbol("nmnmnmn").play("returnedicon");
    button = -1;
    Somehow like the above you'll have to do it.
    Or else you can use boolean , TRUE/FALSE

  • Detecting mouse clicks in editable cell of JTable

    Hi everyone :)
    I thought that this question might have been asked before, but I have searched the forums extensively and have not been able to find the solution.
    What I want to achieve is to detect single and double mouse clicks on JTable cells (that are editable).
    For example, I have a JTable and there exists within it an editable cell. If the user clicks on it once then that cell goes into edit mode, and the user can type directly into the cell. I have already successfully implemented this.
    However, what I also want to do is detect a double-click so that I can pop up a dilaog that shows a list of default values that the user can select.
    So here is what I want;
    1. User clicks on the cell once.
    2. Cell moves into edit mode.
    3. If the user clicks again within a certain time interval then cancel edit mode and pop up a dialog containing values that the user can select from.
    I think that to do this I need to be able to detect mouse clicks on the cell that is currently being edited. So far I have been unable to discover how this is done. I have even tried extending JTextField to get what I want, but with no luck.
    Any help would be greatly appreciated.
    Kind regards,
    Ben Deany

    Thanks for the reply.
    Unfortunately, it is not possible to call 'AddMouseListener()' on a cell editor. You are only able to call 'addCellEditorListener()' and that only allows two events to the broadcast (edit cancel, and edit stop).
    Ben

  • Disable right mouse click and IE6 galleryimg on af:objectImage

    hi,
    Could anyone tell me how I can disable right mouse click and IE6 galleryimg on af:objectImage?

    Hi Jagannath,
    Try like this.. Double click on application -> go to parameters tab, in parameters give WDDISABLEUSERPERSONALIZATION and value 'X'. It will disable user settings, you get window when right click but no user settings available.
    check this for more help...
    http://help.sap.com/saphelp_nw70/helpdata/en/7b/fb57412df8091de10000000a155106/content.htm
    Thanks,
    Kris.

  • Mouse Clicks' Queue when Button is Disabled

    Hi, I was wondering about the Disable property for UI
    Components.
    In the docs it says that when the component is disabled it
    ignores all
    interaction whatsoever - in particular - user interaction.
    In my case, the button is disabled for a few seconds right
    after it
    was clicked by the user (I disable it till the httprequest is
    returned
    and then enable it).
    What happens is that if the user clicks the button while it's
    disabled
    - nothing happens. But when the button turns enabled - it
    acts as if
    it just got the click event.
    It seems like the mouse click event went into this queue and
    the
    button listened to it right after to turned enable?
    Am I correct? If so - how can I prevent this problem?
    If I'm wrong, what's the reason for this? And again, how can
    I sort
    this so the user can't send mouse clicks to the button when
    it's
    disabled??
    Many thanks :)
    Gilad

    "giladozer" <[email protected]> wrote in
    message
    news:gnbng6$o6m$[email protected]..
    > Hi, I was wondering about the Disable property for UI
    Components.
    > In the docs it says that when the component is disabled
    it ignores all
    > interaction whatsoever - in particular - user
    interaction.
    > In my case, the button is disabled for a few seconds
    right after it
    > was clicked by the user (I disable it till the
    httprequest is returned
    > and then enable it).
    > What happens is that if the user clicks the button while
    it's disabled
    > - nothing happens. But when the button turns enabled -
    it acts as if
    > it just got the click event.
    > It seems like the mouse click event went into this queue
    and the
    > button listened to it right after to turned enable?
    > Am I correct? If so - how can I prevent this problem?
    > If I'm wrong, what's the reason for this? And again, how
    can I sort
    > this so the user can't send mouse clicks to the button
    when it's
    > disabled??
    No idea about whether you're correct or wrong, but you might
    want to try
    setting mouseEvents = false on the button and see if that
    helps.

  • Can spark datagrid mouse click be disabled while in a custom item editor?

    Hi,
    Is it possible to prevent a user from clicking on another cell in a datagrid until the cell currently being edited has had its data saved? 
    I would like to validate the cell's text data as it is being entered by a user, character by character.  If the validation fails, I would like to put up an error message and prevent the user from clicking outside of the cell.  I am able to validate the data and put up an error message.  But I have not found a way, if there is one, of disabling mouse clicks in other cells.  I've tried setting the IE's parent.editable, .enabled and .mouseEnabled properties to false.  But none of these are working for me.
    Thanks,
    -Adobegillisisle2

    The session does stay if I hit the TAB or RETURN keys.  I return false from my overridden save() function and the session stays keeping the user in the edit cell, allowing fixing the invalid data.   But I don't get the same behavior when I click the mouse on another cell.  In these cases, my save function is still called, and I still return false ( in the case where the validation fails ), but the edit session goes away. 

  • Is it possible to Disable Right Mouse click In WebDynpro Java Application??

    Dear Experts,
    Is it possible to Disable Right Mouse click In WebDynpro Java Application??
    If yes then kindly suggest how.
    Warm Regards,
    Upendra Agrawal

    What is the use-case?
    Armin

  • Double value of mouse click

    hi, I am making a program in which I need to get the Double value of the point where I clicked on my JPanel. Is it possible to get the Double or float value of the point at which mouse click event occur.

    The mouse pointer is always exactly on one physical pixel, hence the integer coordinates are most accurate. You could pretend that the user means some other point (like the center of the pixel instead of the upper left corner) than the one s/he is pointing, that's your own business.
    You may actually lose accuracy when you cast the ints to doubles or floats.

  • 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.

  • How to disable mouse click ??

    hi ,
    i have a form in which i have a block abc in this there are 5 items say a,b,c,d,e
    suppose my cursor is in item field 'a' there i have entered some value then i go to item field b and entered some value and then i go to field c without any enter or tab but with the help of mouse only. there i want to put a trigger on block level ( on-mouse-click) that whenever anyone tries to move from the current field to another field with the help of mouse then the cursor should be moved to previous item automatically that is item 'b'. in breif i want to disable mouse click from moving one field to another.
    on-mouse-click i can store system.current_item i.e 'a' but not able to store previous field i.e 'b'.
    please help....
    thanks
    Edited by: Hi FRNzzz!! on Feb 23, 2010 7:10 PM

    Hello,
    Try to set the mouse navigation limit form-level property to item when you want to disable the mouse.
    Francois

  • Disabling iebrowser or iecanvas mouse clicking

    How to disable the mouse click event on a iebrowser or iecanvas?

    >No Adobe software, including the Adobe Updater, is known to disable Windows Explorer.
    Please see this tech note: http://kb.adobe.com/selfservice/viewContent.do?externalId=kb408524
    See also this forum thread on the problems described in that tech note: http://www.adobeforums.com/webx/.59b77897/1
    I'm not pointing fingers. I'm not saying that CS4 doesn't work on Vista-64. It certainly had been working just fine for us for a couple of months, and everything but InDesign was continuing to work until we tried to fix InDesign. I haven't seen this particular problem mentioned anywhere else, so I posted the description of the problem and the solution in case it ever happens to anyone else.
    As for incompatibilities, certainly it's possible that there is a third-party catalyst. That doesn't mean that there isn't an incompatibility. The Windows Explorer issue definitely appears to have a third-party catalyst as it only seems to happen on Gateway and HP systems, and it seems to be related to some unusual system directory permissions.
    Matthew Laun has been very helpful in trying to "run this to ground", to find out what the problem is and how to fix it. Which is a whole lot more helpful than declaring that it's not an Adobe problem when Adobe software has an incompatibility with something else.
    And the tech support person got InDesign working for us again. Which is a while lot more helpful than declaring that it's not an Adobe problem when Adobe software has an incompatibility with something else.

  • Why does the ALT key disable mouse clicks on some machines?

    I have a drawing program, the main Window of which extends JFrame and contains a Canvas, which extends JPanel. The Canvas has a MouseAdapter, KeyAdapter and JMenuBar. It also has a Tools palette, which extends JDialog and has Buttons, which extend JToggleButtons.
    One button is called Zoom. After pressing this button, you can Zoom In and Zoom Out by clicking the mouse on a point of the illustration. It differs from pressing Ctrl Plus and Ctrl Minus, because the point where you click is kept in place, and only all the other points move.
    Zooming In is done by clicking the mouse and Zooming Out is done by pressing the ALT key and clicking the mouse. The Zooming In works on all computers, but for some strange reason, the Zooming Out doesn't work on all computers. The computer where it doesn't work, after pressing the ALT key and clicking the mouse, it does not recognize the mouse click, and never reaches the mousePressed method in my debugger.
    The computer where it doesn't work has the Windows XP Professional operating system. But some computers where it does work have the same operating system. The problem also does not depend on the keyboard or mouse, because I tried a different keyboard and mouse, and it still didn't work.
    I wonder if the reason why it doesn't work on some computers has to do with that the ALT key is also used differently (which might depend on the operating system)? Pressing the ALT key and clicking the mouse Zooms In a picture by keeping the point in place and only moving all the other points
    I do not want to use a different key, since one release of my program is a plugin for Photoshop, and Photoshop also uses the ALT key to achieve the same thing.
    Thanks for checking on this! I will appreciate your help!

    Ok, I did apply KeyBindings. Since the AnanyaCurves class extends JFrame, I couldn't apply KeyBindings there, but I could apply KeyBindings to my CurveCanvas class, which extends JPanel, which extends JComponent. However I still have my first two problems:
    1) After pressing the ALT key, clicking the mouse doesn't get recognized. You never reach the mousePressed method, where it's supposed to exit the program.
    2) After opening a menu, such as the Nothing menu by pressing ALT and N, pressing a key which is not an accelerator key of a menu doesn't get recognized, such as pressing the E key. You never reach the actionPerformed method of the exitF action, where it's supposed to exit the program.
    Here is my SSCCE with the KeyBindings:
    import java.awt.*;
    import java.awt.event.*;
    import java.lang.*;
    import java.lang.reflect.*;
    import java.util.*;
    import javax.swing.*;
    import javax.swing.plaf.*;
    public class AnanyaCurves extends JFrame
      CurveCanvas canvas;
      JMenuBar menuBar;
      Command quitCmd;
      JMenu fileMenu, nothingMenu;
      JMenuItem quitItem, nothingItem;
      boolean alt;
      public AnanyaCurves(Dimension windowSize)
        Font boldFont = new Font("Verdana", Font.BOLD, 12);
        Font plainFont = new Font("Verdana", Font.PLAIN, 12);
        Object top;
        Basics.ananyaCurves = this;
        alt = false;
        try
          UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
          SwingUtilities.updateComponentTreeUI(this);
        catch(Exception e)
        UIManager.put("MenuItem.acceleratorFont", new FontUIResource(UIManager.getFont("MenuItem.acceleratorFont").decode("Verdana-PLAIN-12")));
        Basics.ananyaCurves = this;
        enableEvents(AWTEvent.WINDOW_EVENT_MASK);
        setTitle("Ananya Curves");
        Dimension docSize = new Dimension(274, 121);
        canvas = new CurveCanvas(docSize);   
        menuBar = new JMenuBar();
        setJMenuBar(menuBar);
        fileMenu = new JMenu("File");
        fileMenu.setMnemonic('F');
        fileMenu.setFont(boldFont);
        quitCmd = new Command("quit", "ctrl Q");
        quitCmd.putValue(Action.NAME, "Quit");
        quitItem = new JMenuItem(quitCmd);
        quitItem.setFont(plainFont);
        fileMenu.add(quitItem);
        menuBar.add(fileMenu);
        //fileMenu.setVisible(false);
        /*JMenuBar hiddenMenuBar = new JMenuBar();
        hiddenMenuBar.add(fileMenu);
        getContentPane().add(hiddenMenuBar, BorderLayout.CENTER);
        getContentPane().add(new JPanel(), BorderLayout.CENTER);*/
        nothingMenu = new JMenu("Nothing");
        nothingMenu.setMnemonic('N');
        nothingMenu.setFont(boldFont);
        nothingItem = new JMenuItem("NoAction");
        nothingItem.setFont(plainFont);
        nothingMenu.add(nothingItem);
        menuBar.add(nothingMenu);
        addMouseListener(new MouseAdaption());
        addKeyListener(new KeyAdaption());
      public static void main(String[] args)
        Dimension windowSize = new Dimension(300, 200);
        AnanyaCurves ananyaCurves = new AnanyaCurves(windowSize);
        ananyaCurves.pack();
        ananyaCurves.setBounds(0, 0, windowSize.width, windowSize.height);
        ananyaCurves.setVisible(true);
        ananyaCurves.requestFocus();
      public void exit()
        this.dispose();
        System.exit(0);
      class MouseAdaption extends MouseAdapter
        public void mousePressed(MouseEvent e)
          if (AnanyaCurves.this.alt == true)
            AnanyaCurves.this.exit();
      class KeyAdaption extends KeyAdapter
        public void keyPressed(KeyEvent event)
          /*int keyCode = event.getKeyCode();
          if (keyCode == KeyEvent.VK_ALT)
            AnanyaCurves.this.alt = true;
          else if (keyCode == KeyEvent.VK_E)
            AnanyaCurves.this.exit();
        public void keyReleased(KeyEvent event)
          AnanyaCurves.this.alt = false;
    class Basics extends java.lang.Object
      public static AnanyaCurves ananyaCurves;
      public Basics()
    class Command extends AbstractAction
      String name; // the command name (not the menu item string)
      String accelerator;
      public Command(String name, String accelerator)
        super();
        this.name = name;
        if (accelerator != null && !accelerator.equals(""))
          this.accelerator = accelerator;
          KeyStroke k = KeyStroke.getKeyStroke(accelerator);
          putValue(Action.ACCELERATOR_KEY, k);
      public void quit()
        Basics.ananyaCurves.dispose();
        System.exit(0);
      public void actionPerformed(ActionEvent actionEvent)
        try
          Method f = getClass().getMethod(this.name, (Class[])null);
          f.invoke(this, (Object[])null);
        catch (NoSuchMethodException e)
        catch (InvocationTargetException e)
        catch (IllegalAccessException e)
    class CurveCanvas extends JPanel
      public CurveCanvas(Dimension docSize)
        super();
        Action altF = new AbstractAction()
          public void actionPerformed(ActionEvent e)
            Basics.ananyaCurves.alt = true;
        Action exitF = new AbstractAction()
          public void actionPerformed(ActionEvent e)
            Basics.ananyaCurves.exit();
        this.getInputMap(WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("ALT"), "alt");
        this.getActionMap().put("alt", altF);
        this.getInputMap(WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("E"), "exit");
        this.getActionMap().put("exit", exitF);
    In the getInputMap method I was trying to use the condition WHEN_IN_FOCUSED_WINDOW, hoping that the bound key would be recognized, but it didn't work. And, by the way, I still used the KeyAdapter so that the alt attribute of AnanyaCurves can be set to false when the ALT key is released.
    I will appreciate your help very much! Thanks for your time!

  • Popup menu on tab components disables JTabbedPane mouse clicks

    When I add a popup menu to the tab components, the underlying JTabbedPane doesn't respond to any mouse click. How can we solve this?
    import java.awt.*;
    import javax.swing.*;
    import javax.swing.event.*;
    public class TabPopupDemo extends JFrame {
        private JLabel jLabel1;
        private JLabel jLabel2;
        private JMenuItem jMenuItem1;
        private JPopupMenu jPopupMenu1;
        private JTabbedPane jTabbedPane1;
        public TabPopupDemo() {
            setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
            setSize(400, 300);
            setLocationRelativeTo(null);
            jPopupMenu1 = new JPopupMenu();
            jMenuItem1 = new JMenuItem("jMenuItem1");
            jTabbedPane1 = new JTabbedPane();
            jLabel1 = new JLabel("jLabel1");
            jLabel2 = new JLabel("jLabel2");
            jPopupMenu1.add(jMenuItem1);
            jTabbedPane1.addTab(null, jLabel1);
            jTabbedPane1.addTab(null, jLabel2);
            getContentPane().add(jTabbedPane1, BorderLayout.CENTER);
            int tabCount = jTabbedPane1.getTabCount();
            for (int i = 0; i < tabCount; i++) {
                JLabel jLabel = new JLabel("Testing the tab" + (i + 1));
                jTabbedPane1.setTabComponentAt(i, jLabel);
                jLabel.setName(String.valueOf(i));
                jLabel.setComponentPopupMenu(jPopupMenu1);
            jPopupMenu1.addPopupMenuListener(new PopupMenuListener() {
                public void popupMenuCanceled(final PopupMenuEvent evt) {
                public void popupMenuWillBecomeInvisible(final PopupMenuEvent evt) {
                public void popupMenuWillBecomeVisible(final PopupMenuEvent evt) {
                    JPopupMenu source = (JPopupMenu) evt.getSource();
                    JLabel invoker = (JLabel) source.getInvoker();
                    JLabel component = (JLabel) jTabbedPane1.getComponentAt(Integer.parseInt(invoker.getName()));
                    jMenuItem1.setText(invoker.getText() + ":  " + component.getText());
        public static void main(final String args[]) {
            EventQueue.invokeLater(new Runnable() {
                public void run() {
                    new TabPopupDemo().setVisible(true);
    }

    I don't know what the best solution would be.
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    public class TabPopupDemo2 extends JFrame {
      private JLabel jLabel1;
      private JLabel jLabel2;
      private JMenuItem jMenuItem1;
      private JPopupMenu jPopupMenu1;
      private JTabbedPane jTabbedPane1;
      public TabPopupDemo2() {
        setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        setSize(400, 300);
        setLocationRelativeTo(null);
        jPopupMenu1 = new JPopupMenu();
        jMenuItem1 = new JMenuItem("jMenuItem1");
        jTabbedPane1 = new JTabbedPane();
        jLabel1 = new JLabel("jLabel1");
        jLabel2 = new JLabel("jLabel2");
        jPopupMenu1.add(jMenuItem1);
        jTabbedPane1.addTab(null, jLabel1);
        jTabbedPane1.addTab(null, jLabel2);
        getContentPane().add(jTabbedPane1, BorderLayout.CENTER);
        int tabCount = jTabbedPane1.getTabCount();
        TabMouseListener tml = new TabMouseListener(jTabbedPane1);
        for (int i = 0; i < tabCount; i++) {
          JLabel jLabel = new JLabel("Testing the tab" + (i + 1));
          jTabbedPane1.setTabComponentAt(i, jLabel);
          jLabel.setName(String.valueOf(i));
          jLabel.addMouseListener(tml);
          jLabel.setComponentPopupMenu(jPopupMenu1);
        jPopupMenu1.addPopupMenuListener(new PopupMenuListener() {
          public void popupMenuCanceled(PopupMenuEvent evt) {}
          public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {}
          public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
            //JPopupMenu source = (JPopupMenu) e.getSource();
            //JLabel invoker = (JLabel) source.getInvoker();
            int index = jTabbedPane1.getSelectedIndex();
            JLabel invoker = (JLabel) jTabbedPane1.getTabComponentAt(index);
            JLabel component = (JLabel) jTabbedPane1.getComponentAt(index);
            jMenuItem1.setText(invoker.getText() + ":  " + component.getText());
      static class TabMouseListener extends MouseAdapter{
        private final JTabbedPane tp;
        TabMouseListener(JTabbedPane tabbedPane) {
          this.tp = tabbedPane;
        private void dispatchEvent(MouseEvent me) {
          JLabel l = (JLabel)me.getSource();
          tp.dispatchEvent(SwingUtilities.convertMouseEvent(l,me,tp));
        public void mouseClicked(MouseEvent me)  { dispatchEvent(me); }
        public void mouseEntered(MouseEvent me)  { dispatchEvent(me); }
        public void mouseExited(MouseEvent me)   { dispatchEvent(me); }
        public void mousePressed(MouseEvent me)  { dispatchEvent(me); }
        public void mouseReleased(MouseEvent me) { dispatchEvent(me); }
      public static void main(final String args[]) {
        EventQueue.invokeLater(new Runnable() {
          public void run() { new TabPopupDemo2().setVisible(true); }
    import java.awt.*;
    import javax.swing.*;
    import javax.swing.event.*;
    public class TabPopupDemo3 extends JFrame {
      private JLabel jLabel1;
      private JLabel jLabel2;
      private JMenuItem jMenuItem1;
      private JPopupMenu jPopupMenu1;
      private JTabbedPane jTabbedPane1;
      public TabPopupDemo3() {
        setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        setSize(400, 300);
        setLocationRelativeTo(null);
        jPopupMenu1 = new JPopupMenu();
    //     jPopupMenu1 = new JPopupMenu() {
    //       public void show(Component c, int x, int y) {
    //         int i = jTabbedPane1.indexAtLocation(x, y);
    //         if(i>=0) {
    //           JLabel tab = (JLabel) jTabbedPane1.getTabComponentAt(i);
    //           JLabel component = (JLabel) jTabbedPane1.getComponentAt(i);
    //           jMenuItem1.setText(tab.getText() + ":  " + component.getText());
    //           super.show(c, x, y);
        jMenuItem1 = new JMenuItem("jMenuItem1");
        jTabbedPane1 = new JTabbedPane();
        jTabbedPane1.setComponentPopupMenu(jPopupMenu1);
        jLabel1 = new JLabel("jLabel1");
        jLabel2 = new JLabel("jLabel2");
        jPopupMenu1.add(jMenuItem1);
        jTabbedPane1.addTab(null, jLabel1);
        jTabbedPane1.addTab(null, jLabel2);
        getContentPane().add(jTabbedPane1, BorderLayout.CENTER);
        int tabCount = jTabbedPane1.getTabCount();
        for (int i = 0; i < tabCount; i++) {
          JLabel jLabel = new JLabel("Testing the tab" + (i + 1));
          jTabbedPane1.setTabComponentAt(i, jLabel);
          jLabel.setName(String.valueOf(i));
          //jLabel.setComponentPopupMenu(jPopupMenu1);
        jPopupMenu1.addPopupMenuListener(new PopupMenuListener() {
          public void popupMenuCanceled(final PopupMenuEvent evt) {}
          public void popupMenuWillBecomeInvisible(final PopupMenuEvent evt) {}
          public void popupMenuWillBecomeVisible(final PopupMenuEvent evt) {
            JPopupMenu source = (JPopupMenu) evt.getSource();
            int i = jTabbedPane1.getSelectedIndex();
            JLabel tab = (JLabel) jTabbedPane1.getTabComponentAt(i);
            JLabel component = (JLabel) jTabbedPane1.getComponentAt(i);
            if(tab.getMousePosition()!=null) {
              jMenuItem1.setText(tab.getText() + ":  " + component.getText());
            }else{
              jMenuItem1.setText("aaaaaaaaa");
      public static void main(final String args[]) {
        EventQueue.invokeLater(new Runnable() {
          public void run() { new TabPopupDemo3().setVisible(true); }
    }

Maybe you are looking for

  • Roi in xy plot

    how do I plot xy data between two cursor (a ROI) in another xy plot?

  • Can you change devices and keep all of your same apps if they are not saved on iCloud?

    Hey all, Looking to get a new device - have a 4s want to get a new one to replace my current - and I want to avoid downloading all of the same apps that I currently have on my phone without purchasing more iCloud space. Does anyone know if there is a

  • How to print 2nd Page/How to call 2nd page

    Hi Actually in my report there was only one page and I want to add 2nd page which I have added. Now system is not showing 2nd page in output. I put a break point in 2nd page and found that system is not going inside 2nd page. I mean not triggering 2n

  • Email address with AIM Service

    HELP.. Got a Question... My email address is register with the AIM service. Can I use iChat with my register email that I currently use to chat with users of AIM ? or must I have a AIM Screen Name ? Thanks..

  • How can I use FREQ_OUT output frequency signal

    Now,I use VXI-MIO-64E-1 board and Windows/CVI,I want to know how can I use FREQ_OUT single. Thanks a lot, Wang