How to lock the keyboard

Hello,
all i want is to lock all the keys of the keyboard except " arrow keys, esc key, and enter key" and aslo want to make sure that my JFrame should not be closed by "alt+f4".
Looking for Your replies
Thanks in advance
sandy

Try adding a KeyListener and listen for:
KeyEvent.VK_RIGHT
KeyEvent.VK_LEFT
KeyEvent.VK_UP
KeyEvent.VK_DOWN
KeyEvent.VK_ENTER
KeyEvent.VK_ESCAPE
and then use event.consume() on the rest. See the Swing tutorial on "How to Write a Key Listener"
http://java.sun.com/docs/books/tutorial/uiswing/events/keylistener.html

Similar Messages

  • How to lock the keyboard - macbook

    I know most people are trying to UNlock their keyboards....
    My wife uses her macbook to show movies to my 3 and 4yr old while traveling. But the kids can't helpthemselves and after 5 minutes try and "type like mama". which inevitably stops the DVD causes another program to open or something. Anyone with kids knows this instant "mayhem and change" on the screen only encourages the behavior.
    Good kids.. but who can resist playing with a Mac, regardless of how old they are
    Is there a way to lock the keyboard to that only pressing a certain combo will enable it again? (and keep programs/DVD running)
    Thanks
    -mosermac2

    There's not a function to turn off the keyboard however you can turn mouse keys on and most of the keyboard keys will be ignored.
    The shortcut for this is pressing Option five times.  Do it again to turn mouse keys off.
    Also can be set in System Preferences > Universal Access > Mouse & Trackpad tab.
    Regards,
    Captfred

  • How do I 'lock the keyboard' to prevent any more keypresses being sent on X11/Linux/Gnome?

    I am writing an anti-RSI/typing break programme for Ubuntu Linux in python. I would like to be able to "lock the keyboard" so that all keypresses are ignored until I "unlock" it. I want to be able to force the user to take a typing break.
    I would like some programmatic way to "turn off" the keyboard (near instantaneously) until my programme releases it later (which could be 0.1 sec → 10 sec later). While I have "turned off the keyboard", no key presses should be sent to any
    windows, window managers, etc. Preferably, the screen should still show the same content. The keyboard should be locked even if this programme is not at the forefont and does not have focus.
    Some programmes are able to do this already (e.g. Work Rave)
    How do I do this on Linux/X11? (Preferable in Python)

    class KeyboardLocker:
    def __init__(self, serio=0):
    self._on = False
    self.serio = serio
    def on(self):
    return self._on
    def write_value(self,path, value):
    with open(path, "a") as f:
    f.write(value)
    def toggle(self):
    if self.on():
    self.turn_off()
    else:
    self.turn_on()
    def description(self):
    path = '/sys/devices/platform/i8042/serio%d/description' % (self.serio,)
    with open(path, "r") as f:
    description = f.read()
    return description
    def turn_on(self):
    try:
    self.write_value('/sys/devices/platform/i8042/serio%d/bind_mode' % (self.serio,),
    'auto')
    except IOError, e:
    self._on = False
    raise
    else:
    self._on = True
    return self.on()
    def turn_off(self):
    try:
    self.write_value('/sys/devices/platform/i8042/serio%d/bind_mode' % (self.serio,),
    'manual')
    self.write_value('/sys/devices/platform/i8042/serio%d/drvctl' % (self.serio,),
    'psmouse')
    except IOError, e:
    self._on = True
    raise
    else:
    self._on = False
    return self.on()
    if __name__ == "__main__":
    kl = KeyboardLocker(serio=0)
    device = kl.description()
    print "We got a lock on", device
    proceed = raw_input("Do you want to proceed? (y/n)").lower().startswith("y")
    import sys
    if not proceed: sys.exit(1)
    kl.turn_off()
    import time
    wait = 5
    print "Sleeping few seconds...", wait
    time.sleep(wait)
    print "Voila!"
    kl.turn_on()
    raw_input("Does it work now?")
    Tested on Linux Mint 12, X11, HP Laptop, Gnome. Not sure if any of that matters though :)
    UPDATE Added an option to change the path, e.g. "serio0" or "serio1". And prints the description, for me serio0 gave me: i8042
    KBD port, most likely if you have "KBD" in it, it's right, continue, otherwise I give you no guarantee :)

  • Sat M70-181:How to unlock the keyboard?

    Hi,
    My Satellite M70 notebook didn`t accept any key input when Windows has started. I suppose that a kind of keyboard lock has been accidentally activated. Does anybody know how to unlock the keyboard?
    Thank you!
    Andreas
    Message was edited by: Andreas_7

    Hello again,
    The solution of the problem was in bios menue. When I set default settings the keyboard worked again. I don't know exactly which parameter was wrong because I didn`t made any changes in bios before. Anyway I`m glad again.
    Andreas

  • How to work the keyboard viewer to capitalize

    how to work the keyboard viewer to capitalize letters

    I also wish to know how to get the Keyboard viewer caps lock to work while in textedit.
    The caps lock does not work for me while in any of my textedit programs.
    As soon as I release the mouse button, or move off the caps lock,
    the characters revert to lowercase.

  • Is it possible to lock the keyboard of a client from a server using java

    please explain wheterit is possible to lock the keyboard of a client from a server using java

    You want to process code on one machine, and thereby lock the keyboard on another machine? No, that's not possible. It is extremely far from possible.
    Of course, if the client is running software with security holes in it you might hack into it and crash the thing. This will lock up the keyboard pretty good. I hope that's not what you want ...
    Or are you talking about a setup where you already have code running on the client, and some sort of communication between client and server? In that case what you need to know is whether it is possible to lock the keyboard at all. Once you have figured that out, it is trivial to add the communication code to have the server software tell the client software to lock the keyboard.
    So what do you mean with "lock the keyboard"? It's pretty easy to remove/disable all keyboard related listeners in your own application. It's a lot harder (and AFAIK impossible with pure java) to disable alt-tabbing out of the application. And impossible, except from exploiting security holes, to lock the ctrl-alt-delete-combination on windows machine.

  • How to lock the Printer of LaserJet Pro 500 Color MFP m570dw

    how to lock the Printer of LaserJet Pro 500 Color MFP m570dw

    You can set a control panel lock security level and password for your HP LaserJet series printer. To lock your printer, follow below link:
    http://h20564.www2.hp.com/hpsc/doc/public/display?​docId=emr_na-bpl03612

  • How to make like Encarta encyclopedia and basic screen settings and how to lock the documents in the entire data.

    dear guys how can i make like a off line Encarta encyclopedia and basic screen settings and how to lock the documents in the entire data in visual studio.                 
       thank you. 
                                                              Million
    Getu

    Dave,
    I will +1 Pixelan's products. They are great, simple, and have about the best support that I know of. When you explore, say Pixelan's SpiceMaster, dig deeply. Things appear rather mundane, on the surface, but there is so very much power lurking, just below the surface. I could almost imagine a 1000 page manual to cover every possible aspect of that program... Every time that I use it, I learn something new, and wonderful.
    Good luck,
    Hunt

  • How to lock my keyboard?

    Ok so I use my macbook to watch movies on and i have a one year old son that is obcessed with typing. so i was wondering if there was a free program to lock the keyboard and keep the screen on and have to use hotkeys or something to be able to unlock they beyboard. im not getting another keyboard and im not wanting to download keyboard cleaner.

    Set up a password to unlock the computer.
    Or find a used or junk keyboard and let thhe baby play with that, Not a $2,000.00 dollar computer.
    Cheers
    Don

  • How to see the keyboard shortcuts in pages like " alt " function in word?

    how to see the keyboard shortcuts in pages like " alt " function in word?

    luisandre wrote:
    In word , if you press "alt" show you all the options you have . Appear numbers or letters  in each options of the toolbar. So is more easy to work with the keyboard. How do you do this in pages?
    Go to system preferences/language & text/input sources and check the box for Keyboard Viewer.  Then select Keyboard Viewer from the "flag" menu at the top right of the screen.  It will show all the special characters you can make when you press the alt and alt + shift keys.

  • Help! How to hide the keyboard in app...

    I was bidding on an item in the free ebay App (provided by Ebay v 1.6.1 and the keyboard would not hide and I could not place a second bid. I had made one successful bid and then on a second bid (about 2 minutes later) the keyboard would not go away and I could not submit the bid - only enter a dollar value. It was beyond frustrating watching the time tick down and not being able to place a bid.
    Please someone tell me how to hide the keyboard. I tried everything I knew how - tapping the screen, shaking the iphone, exiting out and coming back in and refreshing the app. Nothing would get the keyboard to go away and allow me to touch the submit bid button.
    Thanks in advance and SORRY in advance if this is in the wrong forum!

    Well the ability of how the keyboard shows and hides is a function of what the developer of the app made. Sounds like a bug in their program or just bad usability.
    This is a topic to discuss with eBay as they developed the app. Their code has to control how things happen. Normally leaving a field to type in will make it go away, but if they didn't provide a way to leave focus, then that is a usability issue on their part.

  • Is it possible to lock the keyboard please?

    Hi
    I've got a Pavilion dv6 notebook and would like to know if its possible to intentionally lock the keyboard. This is to prevent my 3 year old daughter from accidentally pressing the keys whilst she watches a DVD.
    A speedy response would be appreciated as we're heading overseas tomorrow (Wed 9 Feb) and I'd like to know the answer before we fly.
    thanks!

    Not really.
    Windows+L locks the laptop and requires a passsword. T
    he problem is that  the notebook can't be used while it is locked.
    You woud be better off buying a travel DVD player if you want to avoid the risk of a three year old's curiousity.
    Best regards,
    erico
    ****Please click on Accept As Solution if a suggestion solves your problem. It helps others facing the same problem to find a solution easily****
    2015 Microsoft MVP - Windows Experience Consumer

  • HT2101 I can't find the keyboard by using iMessage, but I can by using email or whatsapp? How I reset the keyboard on iMessage?

    I can't find the keyboard by using iMessage, but I can by using email or whatsapp? How I reset the keyboard on iMessage?

    Did you tap in the box at the bottom of iMessage?
    If you did and no keyboard is showing: Do a reset
    Reset: Hold down the Sleep/Wake button and the Home button at the same time for at least ten seconds, until the Apple logo appears. Note: You will not lose any data
    If that didn't helped, double tap Home button, delete the Message app and reset again.

  • HT4085 how to lock the tauch screen with some password or dots like android to prevent misuse. And also screen lock to prevent interruption while watching movie reading books etc.

    how to lock the tauch screen with some password or dots like android to prevent misuse. And also screen lock to prevent interruption while watching movie reading books etc.

    You can set a passcode to be requied to unlock the iPad via Settings > General > Passcode Lock. In terms of locking the actual screen whilst using an app, then that isn't currently possible, but with iOS 6 in the Autumn there will be a new 'accessibility' feature (from here) which will allow you :
    ... to limit an iOS device to one app by disabling the Home button, as well as restrict touch input on certain areas of the screen

  • Can you lock the keyboard in position

    Can you lock the keyboard

    You can lock the screen, which would lock the keyboard/Screen. You can "Dock" the keyboard and "undock it". When the keyboard is up, hold your figer down on the bottom right (keyboard picture) and hit dock. To lock the screen double tap home, swipe right, on the far left big circle, tap it.

Maybe you are looking for

  • Error while loading the data from ODS to InfoCube

    hai Im trying to load the data from ODS to InfoCube for particular year . But it says that there is a source system problem . why it is like that . pls tell me i ll assing the points rizwan

  • Shared Services Users are not Visiable in Planning Application

    Hi All, We are using Hyperion 11.1.3 version Problem: We Created Users in Shared Services but those users are not visible in Planning can you suggest me Vijay

  • How can I edit email address for a contact name

    befor the update, we had a command called Contacts through which I could edit names of contacts who changed their address. I cannot find such a command on the new page.

  • Dependent Selectonechoice boxes error

    Hi All, I am using jdeveloper 11g. I have two dependent dropdown boxes (Category and services). Everytime i change the category, the services dropdown needs to be refreshed. I am not using any view objects. The dropdowns are working fine (that is whe

  • Lightroom 6 does crashes on opening

    I have downloaded Lightroom 6 but it always crashes within a split second of trying to open it. I have uninstalled and tried a second time but with the same result. Is anyone else getting this problem? This is on a MacBook Pro (Retina, 13-inch, Mid 2