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!

Similar Messages

  • On my MacBook Pro with Retina Display, Why does the "USB Devices Disabled Unplug the device using too much power to re-enable USB devices" keep coming up after I unplugged the usb device?

    On my MacBook Pro with Retina Display 15", that I purchased a few weeks ago, started coming up with the following message on my desktop:
    "USB Devices Disabled Unplug the device using too much power to re-enable USB devices".
    I unplugged the device and the message still keeps coming up.
    This is what I have done so far to troubleshoot:
    I shut down the laptop. When booting up I pressed the command+option+p+r at the same time. It comes up with a menu to reinstall OSX, Get help online, Run Disk Utility, etc. I choose the disk utility and repair the disk and then restarted.
    The message keeps popping up and I can't seem to get rid of it. Why does the message keep popping up even though I don't have any devices hooked up to the laptop at all? Any help to reenable my usb ports and get rid of the messaage would be helpful.

    I talked to Apple Support and we at least stopped the bleeding, a little bit. These are the troubleshooting steps I did before I contacted Apple Support:
    1. Reinstalled OSX
    2. Restore the last known good Time Machine Backup.
    This did not fix my issue, so I called Apple Support and they told me this:
    1. Turn Power off.
    2. Wait 15 seconds.
    3. Plug in Magsafe adapter.
    4. Wait 15 seconds.
    5. Hold down the Shift+Option+Power Button for 20-30 seconds.
    6. Turn Power back on.
    Ok, this stopped the bleeding a little, but as soon as I plugged in a Apple USB Superdrive
    and a Apple Mini Displayport to VGA Adapter. This "USB Devices Disabled" pop-up pops up like every 30 minutes now. At least, it is not constantly popping up after I close it, so I guess it will do for the temporary. Going to contact Apple support, later, though to see what else can be done.

  • Why does the backspace key now make the browser go back to the last page viewed, and how can I change that setting?

    When typing in a browser page to reply to a blog, when I pressed the backspace key to correct a typo, suddenly the browser went back to the previous web page. How can this setting be changed or turned off?

    This should never happen when the cursor is in an editing control, but it has always done that if the focus was on the page itself.
    Here's how to change it:
    (1) In a new tab, type or paste '''about:config''' in the address bar and press Enter. Click the button promising to be careful.
    (2) In the search box that appears above the list, type or paste '''backs''' and pause while the list is filtered
    (3) Double-click the '''browser.backspace_action''' preference and enter the desired value:
    * 0 => back (default)
    * 1 => page up
    * 2 => ignore (actually, anything other than 0 or 1 does nothing)
    OK to save the change. You're done.

  • Why does the "TAB" key no longer work to move the cursor from field to field with Firefox 17 in MAC OS 10.8?

    The "TAB" key will not move the cursor from field to field with Firefox 17 in MAC OS 10.8. You have to use the mouse to click on the new field to move the cursor.

    See:
    * http://kb.mozillazine.org/accessibility.tabfocus
    Note: In OS X (as of 2005-01), if this preference is not explicitly set, the “Full Keyboard Access” setting in System Preferences will be honored. All builds before that date (e.g., Firefox 1.0.x) will ignore that setting.
    This pref doesn't exist by default, so if you want to use it instead of the system settings then you need to create a new Integer pref with the name accessibility.tabfocus and set the value to what you want (7 is to tab through all the fields).

  • Why does the delete key on the keyboard go backward?  How can I make it go the other way?

    I'm used to a PC keyboard that enables me to delete characters from where my cursor it to the next space to the right.  The keyboard I have with my Mac, alas, is frustrating for me to use because it goes backwards from what I am used to.  Is there a fix to this?  My PC keyboard has a backspace button in addition to the delete button, so it is very straightforward for me that way.

    The delete key, if the cursor is placed mid sentence, will remove letters etc forwards from that cursor point.   If you are deleting from the end of a sentence, the backward facing long arrow above the return key will delete backwards from that point.
    For groups of letters or sentences, highlight them and press delete.
    It is one of those situations where you should learn the new approach because the rest of the system is geared to it.
    Message was edited by: seventy one

  • Why does the latest upgrade disable my iTunes in Windows 7? It corupts somethin in VisualC  .

    The lastest up grades corupts something in Windows 7  and makes itunes unsuable. What can I do.?

    Hi F4Fixer,
    Thanks for using Apple Support Communities.  This article has steps you can take for the error it sounds like you're seeing:
    iTunes 11.1.4 for Windows: Unable to install or open
    http://support.apple.com/kb/TS5376
    Cheers,
    - Ari

  • Why does "Open HTML Report in Broswer" crash on some machines?

    I've been using the "Open HTML Report in Browser" subvi to generate simple printable reports from a control program, but the program hangs on the control system PCs. I am running Win2000 with IE on my programming box, but on the XP machines with IE and Mozilla running the LabView 7 runtimes the program will hang in the Open HTML Report subvi every time. Is there any known cause for this? Are there any alternatives?

    rsd212 wrote:
    I am running Win2000 with IE on my programming box, but on the XP machines with IE and Mozilla running the LabView 7 runtimes the program will hang in the Open HTML Report subvi every time. Is there any known cause for this? Are there any alternatives?
    Hello rsd212,
    The behavior we you are seeing is probably due to the security policies set up on your windows XP machine. Have you installed Service Pack 2 on the machine?
    One way to check if is this is security policy issue is to force the report VI to open the browser with the System Exec VI instead of using DDE. You can do this by opening the Open URL in Default Browser Core subVI inside Open HTML Report in Browser -> Open URL in Default Browser and changing the code to always run the System Exec version and skip the DDE version.
    If this works you can either keep the VI as is or revert to the original version and troubleshoot what security policy is preventing DDE from working on your computer.
    Please let me know if you have any questions.
    Regards,
    Matt
    Keep up to date on the latest PXI news at twitter.com/pxi

  • PP CC. The alt key no longer lets me click to seperate A from V but the shift does...How do i fix it

    PC
    When i hold the alt key & click on either the video or its linked audio it is supposed to only select 1 part but it stopped working. It selects both A&V. Weird also, If i hold the shift key then click, then it works.
    Totally messing me up as i work on 4 different PP CC systems & only 1, of them is doing this.
    Any idea how to switch it back? I tryed looking in the keyboard short cuts but could not find anything. I also copied the .kys from 1 system to this one & still no change.

    That is messed up.  Try resetting preferences.
    https://blogs.adobe.com/genesisproject/2011/02/premiere-pro-cs5-maintenance-two-great-tips .html

  • Why does my mac mini's mouse show a pinwheel every time I hover over the date area? Also, sometimes the date shows up incorrectly.

    Why does my mac mini's mouse show a pinwheel every time I hover over the date area? Also, sometimes the date/time shows up incorrectly. It started happening after I updated to OS X Mountain Lion.

    Launch the Console application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad. Click Utilities, then Console in the icon grid.
    Make sure the title of the Console window is All Messages. If it isn't, select All Messages from the SYSTEM LOG QUERIES menu on the left.
    Click the Clear Display icon in the toolbar. Try the action that you're having trouble with again. Post any messages that appear in the Console window – the text, please, not a screenshot.
    When posting a log extract, be selective. In most cases, a few dozen lines are more than enough.
    Please do not indiscriminately dump thousands of lines from the log into a message.
    Important: Some private information, such as your name, may appear in the log. Edit it out by search-and-replace in a text editor before posting.

  • Why does the mouse move erratically in PSE 13?

    why does the mouse move erratically in PSE 13?

    I'm getting the same thing.  This is the second major problem I've had with Adobe Photoshop Elements 13.  They just corrected the first problem where there was a "default printer" error coming up when printing.  This is ridiculous.
    My mouse freezes erratically when I click on the main drop down menu.  It works okay when editing photos.  The mouse just acts erratically on the Main drop down menus.  My suspicion is the new update that fixed the default printer error has caused this issue.  I am really hoping someone from Adobe is viewing this forum.  It took 3 months for Adobe to fix the printer issue.  I hope this isn't the case with this issue.

  • How do I disable the alt key function?

    I have tried to clean my alt key on my macbook keyboard and now my macbook is acting like the key is hold down all the time eventhough it's not. Have tried to play around with the key, but its still the same. I wonder if I can disable the functions of the alt key in the mac os?

    you can do it system preferences->keyboard and mouse->keyboard->modifier keys. set "option" to no action. however, option is really a pretty useful key so you might consider trying to fix you keyboard.

  • Why does the new Itunes freeze/do nothing when i click on my Ipod touch icon ?

    Why does the new Itunes freeze when i click on my Ipod touch icon to manage my content? All buttones, video, tv, info, music, they all do nothing. i was only able to sync by bringing up the old sidebar. Is this a software glitch, or am i missing a step? I just spent two days reorganizing and labeling all my music for the new itunes, and had to restore my ipod so i could upload my new library. i know what is supposed to come up when you click on the music or info tabs, but nothing happens, only the eject button works. whats going on?

    The screen is telling you to connect the iPod to your computer with iTunes with the USB connector.  iTunes should open and give you instructions as to what to do.  Whatyou need to need to do is to restore the iPod via iTunes.

  • Why does the Right-click - "t" delete a bookmark on the bookmark toolbar, when Right-click - "t" opens a new tab elsewhere. The bookmark toolbar use Right-click - "w" to open in a new tab. Please change this to "t" to...

    Why does the Right-click -> "t" delete a bookmark on the bookmark toolbar, when Right-click -> "t" opens a new tab elsewhere in Firefox. The bookmark toolbar use Right-click -> "w" to open in a new tab. Please change this to "t" to... I keep deleting all my bookmark because you don't make the commands consistent!

    If you have accidentally removed bookmarks then use "Organize > Undo" in the bookmarks manager (Bookmarks > Organize Bookmarks) to get them back.<br />
    The Organize button is the first of the three buttons on the toolbar in the Library (Bookmarks Manager).<br />
    That only works if you haven't closed Firefox.
    [https://bugzilla.mozilla.org/show_bug.cgi?id=301888 Bug 301888] – Bookmarks cut instead of opened in new tab from Bookmarks Toolbar Folder
    (please do not comment in bug reports; you can vote instead)

  • Disable the alt key?

    Hi everyone,
    As my name suggests, I am a student who is not a techie so please excuse me if I make any mistakes, and I would like to mention that any kind of re - coding would be useless because I am hopeless
    with computers.
    I recently had a friend come over, we are working on a school project together. I'd gone to get us some drinks and I came back upstairs and he was mucking about with the keys on my laptop. A few minutes later I tried to go into bookmarks (on Mozilla Firefox)
    and the bars weren't there (file, edit, view, history, bookmarks, tools, help) and he'd told me to press alt. I did and they re - appeared. Phew. But when I click off anywhere on the screen, the bars disappear
    yet again. It wasn't like that before, and yes, I am certainly sure. Now I have to press the ALT key every time I want to use any of the bars; and while it doesn't render my laptop useless, it is rather annoying.
    I am using Windows 8.1 on a Lenovo G505.
    P.S. Sorry if I chose the wrong forum, as I say, I have no understanding of most of the forums' meanings & what they're for.
    Hope someone can help,
    Thanks for reading.

    You posted to the VB Developer's forum - definitely not the right place.
    It sounds like the problem is related to Firefox options, so you might try a Firefox forum.  If the problem is occurring in every program (not just Firefox) then it may be a Windows8 Setting and you could visit a Windows 8 forum.  Either way, it
    definitely won't be any of the forums here at MSDN.
    Sorry about that; moving this to off-topic.
    Reed Kimble - "When you do things right, people won't be sure you've done anything at all"

  • Why does the Apple mouse drain so quickly?

    I'm not sure if this question is in the right place. I bought a iMac back in January and I've been changing the batteries like every few weeks. My question is why does the mouse drain so quickly?
    The batteries in the keyboard have been in there since I got the computer. I think I should buy a wired mouse and just plug it into the back of the iMac. I'm getting sick and tired of having to change the batteries so often.

    Hello:
    Battery drain is a function of how much the device is used (no surprise to you).  I find that my mouse batteries last less - probably because I type so slowly, I use the mouse for anything I can.
    Let me give you a suggestion based on my own experience.
    I use rechargeable batteries and a 15 minute battery charger.  I currently have a drawer full of Energizer 2450 mAh rechargeable batteries and an Energizer 15 minute charger (works for AA and AAA batteries).  Rechargeables last less time than Lithium batteries - I think the reason is different voltages (1.2 vs 1.5).  I obtained all of the batteries and the charger - new - on eBay at a very reasonable price.
    By using rechargeables, you are never without a fresh battery more than 15 minutes, and you are environmentally friendly to boot! 
    Barry

Maybe you are looking for