Detecting the shift or ctrl key in the mousePressed event, ...

In the mousePressed event, how do I detect
if the shift or ctrl key is pressed?
Thanks,
Ben

What I've posted is for j2sdk1.4, check the link below for older version:
http://java.sun.com/j2se/1.4/jcp/j2se-1_4-rc-mr_docs-spec/apidiffs/java/awt/event/MouseEvent.html#DIFF1
;o)
V.V.

Similar Messages

  • Selecting Multiple rows using Shift or Ctrl key

    Hi all,
            I have a requirement as given:
          Unless a user has used a shift or Ctrl key the multiple selection of rows should not be allowed in a tableview . Can anyone help me in this regard??
    Thanks in Advance,
    Chandana.

    Thank you for letting me know this. Is the reason I can use the "Shift+[letter]" shortcut key because a browser doesn't have this as a default option??
    Do you have recommendations of workarounds when trying to create courseware to exactly match what someone would do in the application? Any feedback on this topic is greatly appreciated!!!
    Thanks!

  • Using javascript to detect the onclick event over a datatable row

    Hi all,
    I'm working with JSF 1.2 R.I. and I would like to add some javascript to my datatable to be able to control the onclick event on a row.
    At the moment I have just added a checkbox to be able to know which row the user wants to select but I'm not satisfied with this solution.
    <h:dataTable
    value="#{person_iupopulations_Observation.customer}" var="customer"
    rowClasses="evenRow,oddRow"
    cellspacing="0">
    <h:column>
    <f:facet name="header">
    <h:outputText value="Select" />
    </f:facet>
    <h:selectBooleanCheckbox value="" onclick="getRow(this)">
    </h:selectBooleanCheckbox>
    </h:column>
    <h:column>
    <f:facet name="header">
    <h:outputText value="Name" />
    </f:facet>
    <h:outputText value="#{customer.Name}"></h:outputText>
    </h:column>
    </h:dataTable>
    What I would like to achieve is:
    When the user clicks the row (wherever, not only the checkbox) the checkbox changes to the new value depending, off course, on the user's selection.
    For this purpose I would need to add the onclick event to every row and associate it to a javascript function to update the checkbox.
    Can anybody help me please.
    I appreciate any suggestion.
    Thanks in advance!

    I am looking for answers on how to use javascript to detect the onclick event over a datatable row . I have a selectBooleanCheckBox in one of the columns in the every row in the table. On click of the checkbox in any row of the table, I want to get some values from the selected row and also verify that the rest of the checkboxes in all the other columns are unchecked. I want to do this using javascript. If any of you have answers, please repsond. Thanks.

  • Detecting the send event in Outlook addin

    I'm trying to write an Outlook AddIn app in C# using Visual Studio 2012.  I need to detect when the send button is clicked in a current email.  I'll want to perform some actions after the send button has been clicked.   
    I assume an event handler needs to be created, but I'm not sure where- at the item level, or application level.  I created a mail item object with Outlook.MailItem publicItem = (Outlook.MailItem).this.OutlookItem.  It seems like I should be detecting
    publicItem.send but I'm not clear on how and where to use event handlers in this case.  
    I added a checkbox, and Visual Studio created publicCheckBox_Changed(object sender, EventArgs e) for me.  To check if the box was checked, I used  'if(publicCheckBox.checked) { do stuff }.   Is detecting the send event similar? 
    I'm new to c# and Outlook Addins, and fairly new to coding.  
    Thanks for your help. 
    Wayne

    Hello Wayne,
    In the check box Clicked event you can add a user property to the MailItem (see UserProperties.Add). Then in the ItemSend event ( see the Application class) handler you can check out the property value - whether it is set or not. Be aware, the Cancel parameter
    passed to ItemSend event handler allows to prevent the item from sending.

  • My homepage shrunk when I accidentally pressed the ctrl key and the underscore key ( I mean't to press the shift key to underscore)

    I was entering a website a wanted to visit which required an underscore,
    but instead of pressing the shift key along with the ' underscore ' key (-_), I pressed the ctrl key and my firefox homepage shrunk to where the print was unreadable. How do I bring the homepage back to where it should be?

    Reset the page zoom on pages that cause problems: <b>View > Zoom > Reset</b> (Ctrl+0 (zero); Cmd+0 on Mac)
    See:
    * http://kb.mozillazine.org/Zoom_text_of_web_pages

  • Is there a way to swap the Fn key and left Ctrl key

    Is there a way to swap the functions of Fn key and left Ctrl key on the keyboard. I'm used to other keyboards where the keys are switched and I keep pressing Fn when I want to press Ctrl.  I figure I'll get used to it eventually, but when I use the laptop in a docking station with a regular keyboard the control key is in one spot and undocked with the Lenovo keyboard the function key is there instead, which makes it hard to get used to.
    If not is there a way to disable the Fn + Space bar function that changes the screen resolution. The programs I use use control + space heavily and my screen resolution keeps changing when I don't want it to.
    It's a small thing I know, but very maddening.

    Thanks, I took the survey. It's interesting the questions on there were asking about location of keys like page up and page down. I find the position of those keys are not that important to me because I don't use them that much and don't seem to mind looking at the keyboard to find them. Also they are almost always in different spots depending on whether you are on a desktop or laptop keyboard so I guess I'm used to unconsciously switching depending on which keyboard I'm on.
    But the left control key is one of the most heavily used, at least by developers like me (control+c to copy, control+v to paste, and control+space for code assist, shift + control + f to format code, shift + control + r to find resources, etc...). I have to hit that Ctrl button 1000 times a day. And the key is in the bottom far left corner on every keyboard (desk top and laptop) I've ever seen until now. Having to remember to look down at the keyboard to find the key is proving difficult and I think is actually hurting my productivity. Especially control+space (when you are expecting a popup to automatically complete the line of code you're working on and instead the screen blinks, resizes and your whole editor loses focus it really breaks your flow of thought, so thanks a million for helping me turn off the silly screen zoom feature).
    Hopefully I'll get used to it like with the other keys like page up and page down although I've had the laptop for two weeks and it's proving difficult. If I had know that Thinkpads have this layout and how maddening it would be to get used to it I probably wouldn't have bought it, even though everything else about it is great. It's amazing how such a small thing can become such an irritant.
    Well thanks again, and if anybody from Lenovo engineering is reading this post, my vote is for some bios setting on the T61P that swaps the functions of Fn and Left control key. It would save me a lot of grief anyway.

  • Detecting the TAB key

    With a recent release of Java, a KeyListener no longer detects the TAB key, which is now apparently considered to be a focus event, not a keyboard event. It is critical to our application, a terminal emulator, that we be able to detect TAB and SHIFT-TAB. I read somewhere about a work-around involving a FocusListener, but a FocusListener does not report when the TAB key is pressed. Can somebody help me here?

    I seem to have solved the problem, and I'd like to present my solution in case anybody else runs across the problem.
    We use an AWTEventlistener. This is intended to watch AWT events but not handle them. However, there is no reason why we shouldn't process tab events within it. AWT will continue to process the tab key as a focus switch, but this solution enabled us to get our applet working again. I hope that future releases of Java will pay more attention to backward compatibility however, so that this kind of fix is not needed.
    In the canvas class:
    // Add the event listener provided we are on a version of the VM
    // that supports it.
    try {
    if (Class.forName("java.awt.event.AWTEventListener")!= null) {
         Toolkit.getDefaultToolkit().addAWTEventListener(new Myeventlistener(), AWTEvent.KEY_EVENT_MASK);
    } catch (Throwable e) {}
    import java.awt.*;
    import java.awt.event.*;
    public class Myeventlistener implements AWTEventListener
    public void eventDispatched(AWTEvent e)
    KeyEvent k = (KeyEvent) e;
    if (k.getID() == k.KEY_PRESSED) {
    if (k.getKeyCode() == 9) {
    if (k.isShiftDown())
    // Process as BackTab Key
    else
    // Process as tab Key

  • Use of the Ctrl key

    Hi all
    does anyone know of a method whereby I can use the Ctrl key (or Alt/Shift) as a trigger for an action?
    Spiersy

    Which version of Firefox do you use?
    You have a weird user agent:
    * Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.0; hi, Mom) Gecko/20020604
    Try to reset the preferences.
    * http://kb.mozillazine.org/Resetting_preferences
    * http://kb.mozillazine.org/Preferences_not_saved

  • I need to reprogram the delete and enter key to the left side of a external keyboard for the ipad mini. don't need the caps/lock or ctrl key and due to an injury my daughter can only use her left hand to type. She is using a text to speech app to verbaliz

    I need to reprogram the delete and enter key to the left side of a external keyboard for the ipad mini. I don't need the caps/lock or ctrl key. Due to a brain injury my daughter can only use her left hand to type. She also uses a text to speech app to verbalize all of her needs since her speech isn't intelligible any longer either. And her vision was significantly affected also, so the keyboard has to be mounted about 6 inches from her face. So to reach across the keyboard with her left hand to the right side delete and enter button is physically difficult and causes typing errors, which cause people to not understand what shes trying to say.
    The best keyboard so far is the Zagg folio mini. I just had to make stickers to enlarge the letters on the key buttons.
    Does anyone know how I can reprogram these two keys? Or where I can buy a wireless mini keyboard for Ipad made for lefthanders with these two functions on the left side. I have searched for days and days. It's sooooo important to me that she be able to contribute her voice again. Imagine if you got in a car accident and couldn't speak clearly any longer, but understood everything still. Thanks for any help and suggestions you all take the time to share with me. I really appreciate the kindness of strangers to help me help my daughter.
    Sami's mom

    Sami\'s mom wrote:
    I need to reprogram the delete and enter key to the left side of a external keyboard for the ipad mini.
    You cannot.

  • How do I check if the ctrl key is pressed from within a mouseReleased actio

    How do I check if the ctrl key is pressed from within a mouseReleased action?
          addMouseListener( new MouseAdapter() {
             public void mouseReleased( final MouseEvent e ) {
               // If ctrl button is held down and mouse is clicked, do something
             }};

    Found it, I think
        e.isControlDown()

  • Is there a hidden screw or latch under the ctrl key to release the keyboard on the HP ENVY dv6-7250?

    The keyboard is damaged and I want to replace it.
    I have a HP Envy dv6 Notebook PC Model # C2L44UA#ABL with S/N {Content Removed}
    i believe the part number is B6R23AV WIN 8 MULTI lANGUAGE 64.1.1 dv6 for the keyboard.
    I removed all the screws and separated the top surface that holds the keyboard but something under the ctrl key is holding everything together.
    Is there a release mechanism in that area. If so how does it work?

    Maybe this will help:
    How to disassemble HP Pavilion dv6 laptop
    Kind Regards,
    Dragon-Fur

  • Is there a way to change the Alt key to the Ctrl Key?

    Is there a to access the Alt key screen functions (the quick Eyedrop, (holding Alt and click the color) and the Zoom in and Zoom out (holding alt alt and scrolling with the mouse wheel) with other key instead of alt, for instance the Ctrl key?
    It is really annoying to me to deal with it, because in my shortcut configuration I use the keys "Q" and "W" to increace and decrease the size of the brush and the keys "A" and "S" to increase and decrease the hardness of the brush. What happens is that when I hold Alt to pick a color or to zoom, it calls the menu bar's shortcuts (it underlines the menu shortcuts) , so If I do so and press "S" it calls the Select menu, which is not what I'm trying to do.
    In Gimp, the pick a color and zoom in and zoom out actions are configured to work with the Ctrl key instead of Alt, so the shortcut menus are not an issue. Is there anyway to switch it to Ctrl? Is there anyway to make the Alt stop calling the menu bar?
    Thanks

    Hello, Other than a keyboard remapping software, you might be out of luck.

  • Why are all my keyboard shortcuts using the "Alt" key instead of the "Ctrl" key? I'm using Windows 7 and Firefox 5.0.1.

    I recently downloaded Firefox 5 and noticed that all my keyboard shortcuts default to using "Alt" key instead of the "Ctrl" key (so, for example, opening a new tab is Alt + T instead of Ctrl + T).
    I noticed that this is even true for copying and pasting within Firefox (Alt + C and Alt + P are the only commands that work).
    Any idea why this is happening? I am running Windows 7 and Firefox 5.0.1.

    Thanks, eveostay! That worked. (And for the record, what a crazy user agent string...)

  • Help: How Can I turn off a sound bound to the CTRL key?

    Hi, I made a small Unity3D game using the CTRL key as the fire button. There I added a sound to the CTRL key. Now all of a sudden that key always makes that sound "on mouse release". No help even after deleting the sound file, clearing the PR Ram, making restarts. OS X Yosemite on my iMac 5k will always make that sound initially only active during the game. Any help appreciated. Thanks Rolf

    Problem found - there was a hidden web page open with a similar game that accepted the CTRL key. :-)

  • How to detect the key enter with a numerical control without using loop event?

    I want to accept a numerical value only when the key enter is pressed, but without using the event. How to detect the char "enter" with a numerical control?
    Thanks!

    When the user edits a numeric control with a keyboard, its property "key focus" is true. When the user hits enter, key focus becomes false. Poll the property to latch the control valuse at the true-false transition. That won't work if the user modify the control using up and down arrows.
    LabVIEW, C'est LabVIEW

Maybe you are looking for

  • Error in loading dlls

    Hi All , Iam facing a problem in loading dll . For the first time "System.loadlibrary(sapsecu.dll)" is running fine. If i run my application again it is throwing an error " Native Library C:\WINDOWS\system32\sapssoext.dll already loaded in another cl

  • Ipod Mini's Hold Lock not working.

    Hi, My girlfriend's Ipod Mini appears to be stuck with the Hold Lock permanently on. The Ipod can not be turned on nor does it respond when it is hooked up to the computer. I have updated it's software but I am unable to reset it. Can you suggest any

  • HT1386 Can't sync my iPhone 3gs: "store- authorize... ok", "sync ... your compurter is no longer authorized..." error

    Can't sync my iPhone 3gs: "store->authorize... ok", "sync ... your compurter is no longer authorized..." error how to solve this issue, help me

  • Snow Leopard and new hard drive

    I want to install a new hard drive in my MacBook and then restore from Time Machine. After I install the new hard drive do I have to reboot from the original OS X disk that came with my MacBook or can I just use the new Snow Leopard disk and restore

  • Restricted Key Figure Column heading text missing

    Hello, I created a restricted Key Figure in a BEX report and dragged this RKF into the columns tab. when i execute the report , the column header text for the restricted key figure is missing. The values are fine, but the header column text  for that