Determining what key is pressed in keyEvent

I have a method which checks whether or not a digit has been entered into a text field (as I do not want alpha characters) but the way I have written it does not currently allow for backspace, does anyone know how to do this?
Cheers

And here is a link to a section in the Swing tutorial that explains what a document is and provide sample code:
http://java.sun.com/docs/books/tutorial/uiswing/components/textfield.html#validation

Similar Messages

  • My MacBook Pro's screen just started randomly going blank, sometimes white sometimes black, and I won't be able to do anything no matter what key I press unless I restart it via the power button and even then I have a few minutes before it happens again

    MacBook Pro's screen randomly goes blank (white sometimes dark), wont be able to do anything no matter what key i press unless i turn it off and on via the power button. When i do that I normally have just a few minutes before it happens again. Bought this back in december just started happening a few days ago. Only thing out of the ordinary I've done is install that microsoft silverlight or whatever it is netflix asked me to install to watch the videos but I uninstalled that quickly hoping it would fix my problem but it hasn't so please help me out if you know what to do

    Try a SMC reset:
    http://support.apple.com/kb/ht3964
    Ciao.

  • What Keys to press to get Windows 7 Task Manager on MacBook Pro ?

    What Keys to press to get Windows 7 Task Manager on MacBook Pro ?

    Thanks for the help. I got the Task Manager thru the taskbar,  but I was and still am trying to it by key entry because that is what I am used to.  My MBP has a delete key, unlike other keystroke attempt that I have
    tried where a delete key isn't on a Mac.  I also am a retired enggggineeeer so there's bound to be confusion because I am left-handed too.
    Thanks again !!!!
    Macbook Pro, Mac OS X (10.6.7), 15", 2.4 GHZ Core Duo 5 CPU, 4 GB RAM, 200 GB Hard Disk;                                                                                                                                           iPhone 4

  • What key to press to reboot into main screen?

    Sorry I don't know how to call that screen but I know when I restart I need to hold onto a key and I'll be lead into that screen, I want to delete my Windows XP partition in there. Can someone please tell me what key I should be holding when I'm restarting? Thank you.

    If you are asking how to switch between Windows and OS X then restart the computer and after the chime press and hold down the OPTION key until the boot manager screen appears. Select the desired startup volume and click on the down arrow button. You cannot delete the Boot Camp partition from the boot manager screen. To delete the Boot Camp partition you must use the Boot Camp Assistant in your Utilities folder.

  • Macbook Pro's screen goes black after going to sleep and won't turn on no matter what key I press

    Hi there, I just got a new Macbook Pro, it's literally six days old. I just got some new memory installed on it and now the screen frequently stays black after it has gone to sleep for several minutes. No key will reawaken my laptop, though the small light indicating power at the bottom right hand corner of the laptop still glows, making me think the laptop is still on. Is this normal? Is there any way to remedy this?

    Read the user manual to make sure you installed the ram correctly.  Put the old ram back in.  Same issue?
    If you were not the person that installed the ram, return the computer.
    Call Apple Care. 
    #1 - You have 14 days from the date of purchase to return your computer with no questions asked.
    #2 - You have 90 days of FREE phone tech support.
    #3 - If you've purchased an AppleCare Protection Plan, your warranty last for 3 years.   You can obtain AppleCare anytime up to the first year of the purchase of your computer.
    Take FULL advantage of your warranty.  Posting on a message board should be done as a last resort and if you are out of warranty or Apple Care has expired. 

  • HT1343 What keys to press to close open applications in dock all at once

    Can someone tell me the shortkey keys to close all open items in my dock at once.

    Upper left corner.
    As far as I know, there is no shortcut, besides shuting down, to quit all apps.
    You can hold the option key and click on a window and it will in effect hide all other open windows, but this is different.
    You can hold the command key and Tab to see the heads-up view of open apps. Here you can mouse or tab and hit Q for quit.

  • Determine if Ctrl key is pressed.

    I want to perform some actions when handling Mouse Move event only when Ctrl key is pressed. Is there a way to determine pressed state of Ctrl key?

    Hi Jonni,
    I've attached a simple example VI that uses the Mouse Move event filter to check for mouse movement and calls user32.dll to check if CTRL key is pressed. I think that is what you are looking for.
    Sev K.
    Applications Engineering Specialist | CLA
    National Instruments
    Attachments:
    GetCtrlKey.vi ‏12 KB

  • My iMac started and locked onto a white screen. Rebooted and all was well. How do you do a safe start i.e. what key do you press?

    My iMac started and locked onto a white screen. Rebooted and all was well. How do you do a safe start i.e. what key do you press?

    It should according to http://support.apple.com/kb/ht1455. Review that and try again.

  • What key do I press so I can get a basic boot, like safe boot in windows?

    What key press do I make, booting Lion, to get a basic boot up? Like "safe mode" in windows.

    Read Safe Mode .

  • What key do I press to eject my SD memory card?

    What Key do I press to eject my SD memory card from my macBook Pro laptop? Thanks.

    It does not eject like a CD/DVD does. You unmount the card from the system and then just pull it out. See:
    http://docs.info.apple.com/article.html?path=Mac/10.6/en/28068.html
    Regards.

  • Determine whick key press from Key board in forms

    Hi ALL,
    I have use a ActiveX (OCX) (RichText Object) in forms. When value
    entring in Text item i want to know which keyascii code is generated.
    I have try a OLE Importer from tools menu and get events for RichText
    OCX Object. Please send me a .FMB for above scenerio.
    Regards.
    Shahid Hussnain Raza

    The only way to get key and mouse events in swing that is available on all systems is using event listeners, which you already know.
    In a system where I needed to poll the mouse at arbitrary times, I combined the event notification of swing with a singleton state machine that kept the current state of the mouse (and in your case the keyboard too) and then when I needed to see the state of something, I just checked the singleton.
    The singleton instance would need to be added as a keyboard and/or mouse listener to the main focussed panel / frame.
    In your case, the singleton would have to implement the relevant mouse and keyboard listeners.
    When the mouse motion listener is fired (probably in a separate class) poll the singleton for the current key state
    ie
    MyKey [] keysDown = singleton.getKeysDown();
    In the singleton, every time a key is pressed note it, every time a rey is released, note it etc.
    This is a neat way to simulate key polling but leverage the swing event model.
    Comments?

  • No key event when compose keys are pressed

    I am supporting a legacy application for Sabre which maps some of the keys differently. For example, on a French keyboard the Compose key which is used to put a ^ on top of the vowel characters is to be remapped to produce a special character called a "Change Character" that has a special use for reservation agents that use Sabre
    The problem is, the first time you press the ^ compose key there is no key event apparently because the VM figures it doesn't yet know what key to report, it is expecting you to press a character such as 'o' and then you get an 'o' with a '^' on top of it.
    If you press the ^ compose key a second time, you get the following key events:
    keyPressed
    keyTyped
    keyTyped
    keyReleased
    On the screen you will see two ^ characters appear. Currently I remap the ^ character to the "Change Character", and I suppress the second keyTyped event so that I only get one character. The problem is that the user ends up having to press the key twice to get one "Change Character."
    I have no fix for this problem because there is no key event produced when they press the ^ compose key the first time.
    By the way, this behavior appears to have been introduced with jdk 1.3. The older jdk did produce a key event the first time you pressed the compose key. I would expect that this behavior was considered to be a bug and was fixed in jdk 1.3.
    Is there some other way to detect when the user presses a compose key? If not, is it possible for future jdk releases to report a keyPressed event when a compose key is pressed? This event would not cause a character to appear on the screen, but would allow programs to detect when the compose key is pressed.
    There is already a key on the French keyboard that behaves this way. It is the key to the left of the '1' key and it has the pipe symbol on it. If you press Shift plus this pipe key, no character is produces but a keyPressed event with a keycode of 222 is produced. I merely point this out to show that there is a way to report key events whithout producing output on the screen.
    Thanks, Brian Bruderer

    I don't know if this actually helps, but it seems that you can bind an Action to a dead key like the circumflex of the French keyboard
    Keymap keymap = textPane.addKeymap("MyEmacsBindings", textPane.getKeymap());
    Action action = getActionByName(DefaultEditorKit.beginAction );
    KeyStroke key = KeyStroke.getKeyStroke(KeyEvent.VK_DEAD_CIRCUMFLEX);
    keymap.addActionForKeyStroke(key, action);I saw this on a Swing tutorial and modified it slightly. Have a look at it :
    http://java.sun.com/docs/books/tutorial/uiswing/components/generaltext.html
    Chris

  • How do I determine what version of Apache I'm using?

    How do I determine what version of Apache, 1.3 or 2.0, I'm using?

    If you're using the stock Apache, it's 1.3 on regular OS X. I think it's Apache 2 on OS X Server, but I'm not certain.
    If you're asking because you've installed Apache 2, but want to make sure it's the one that's running and not the stock Apache, one way to tell is to examine the headers it returns. This Terminal command will show your headers (just enter it and hit the "return" key):
    <pre class="command">curl -I http://localhost</pre>
    Here's what I get:
    <pre class="command">HTTP/1.1 200 OK
    Date: Mon, 02 Jul 2007 13:09:06 GMT
    Server: Apache/1.3.33 (Darwin) PHP/5.2.0 mod_perl/1.29
    Content-Type: text/html</pre>
    As you can see, I have the stock Apache, but I've installed PHP5.
    charlie

  • Mac shut down due to problem; I rebooted fine. how do I determine what the problem was?

    mac shut down due to problem; I rebooted fine. how do I determine what the problem was?

    When shut down and rebooted, the Mac OS X does background maintenance on the system. That can solve minor issues.
    Beyond this, it is a good idea to run Disk Repair yourself just to make sure.
    Reboot with the option key held down. On the screen that comes up select the Recovery disk icon and Continue.
    On the next screen Clcik Disk Utility and Continue.
    In DU, in the list on the left select the drive to be repaired - click the item that is indented to the right, not an an item whose name starts on the far left.
    Click First Aid, then Repair Disk.
    After that is done, quit DU and restart as usual.

  • IPhone letters don't pop up when keys are pressed

    You know how the letters pop up from under your finger when keys a pressed on the keyboard to let you know which key you press, well sometimes certain letters on my keyboard stop popping up. A restart fixes the key but a few minutes or hours (intermittent) later a different letter stops working. Anybody else have this problem?

    The problem seems to be related to the Auto-correct and Auto-capitalization feature. If I turn either one off (Settings->General->Keyboard), I don't have the problem but when both are on, it comes back. It also seems to affect the first character that I type in the input field.
    With both Auto features on, if I go to the login page of Twitter and type, say, a 'v' as the first character of the Username, a capital V is entered and the "V" pops up, but if I backspace, tap shift to go to lowercase and tap v again, the v does not pop up from the keyboard but it does show up in the username input field. I can reset things if I tap the Done button on the keyboard then tap in the username field to bring the keyboard back up. The problem is still there, but I can see it happen with a new letter if I want.
    Try it and post what you find. You don't have to have a Twitter account to see it happen and I'd be interested to know if it's consistent.

Maybe you are looking for

  • Radio Buttons w/ Multiple Values on a PHP Form

    Hi, I have an Online Registration form with several options that each have their own prices.  I want the form results to show the name of each option the user selects, and the total of all the prices combined.  My question is how can I do that when e

  • Capture better photos in low-light conditions

    The camera in your device provides several modes and settings to help you take photos or record videos in most conditions. When the lighting conditions are poor, refer to the following tips: Use Normal capturing mode instead of Scene recognition capt

  • Drag and drop files to library on a Mac

    Does anyone know how to do this? I feel silly asking how to drag and drop...yet it doesn't appear to be allowed on my Mac. I don't want to import to library because I import a lot of PNGs most of the time and Flash creates symbols for me (again, only

  • Oracle ESB before version 10.1.3 ?

    Hello guys! I'm looking for Oracle implementation of ESB prior to version 10.1.3 to convey a proof-of-concept project. According to the page http://www.oracle.com/technology/tech/soa/index.html, it seems that I have to use BPEL. Is it the same as ESB

  • 2 monitors

    can I run 2 monitors at the same time (both apple) with my mini (1.8 intel)?