Increment once per key press

I'm trying to find the 'proper' method to do this basic concept of incrementing a value (in this example) once per key press:
Is there a more efficient (using less cpu and/or less code) way to do this?
I am also curious why you can't add shift registers to the case structure.
Solved!
Go to Solution.
Attachments:
Feedback node run once per button press.vi ‏9 KB

martinv wrote:
(Note I posted this before seeing the 2 replys that snuck in before this post)
I think I get it.  Is this what you described (Pic Below)?
I first thought the loop would be running continuously, but after putting on an indicator I see it does nothing until the case inside is finished. 
Glad to see you figured it out.  Slight edits I recommend:
1) Make a case in your event structure for the Stop:Value Change and put the stop terminal inside of that case.  You will then wire the value of the stop button (or a true constant) from that event case to the loop conditional terminal.  This will allow you to stop your loop immediately instead of being forced to wait for another event (or possibly 2) before actually stopping.
2) I would use a shift register for the value.  This way other cases can affect/read the value without the use of a local variable.  Be sure to wire the value through all of the other cases.
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines

Similar Messages

  • Once per session, connected anyway

    I have an authentication scheme that is set to once per session. The users are defined in oid and have to logon using sso.
    So far so good. But in following scenario it goes wrong.
    1. User enters the htmldb url
    2. User gets the logon screen from sso
    3. User logs in and is than forwarded to the application where the authorisation scheme says him he has no access and he is redirected to a public page that tells him this.
    4. the user presses the 'Back' key on the browser, so he gets the login screen again.
    5. he enters again his username and password, and enters.
    -> now he is logged in and gets the screen he is not allowed to.
    What goes wrong here? Why does the session not remember that this user has no access ?
    Grtz,
    Chris.

    Scott,
    The solution of htmldb_util.reset_authorizations works fine. But in the end we choose another option.
    We are using the error page now to display wether the user has no access to the application. It looks like the user has access to the error pag even if he has no access to any of the application pages. Now it works fine.
    Now the authorization also returns false.
    Tnx for the replies,
    Chris.

  • J2ME: can you clear the key pressed buffer on a cell?

    I am having trouble with keypressed.
    I am writing a cell phone game in MIDP 2.0. Basically its the standard GameCanvas setup, where you have a main game loop and it calls your input function. The input function then does:
    int keyStates = getKeyStates();
    keyprocessing
    to get the states.
    When I demo it on the color phone in WTK2.0, and tap the right arrow, and my input loop processes the right multiple times. My initial thought was that the loop ran too fast perhaps and it read the press several times, so I put in a delay before keyprocessing:
    int keyStates = getKeyStates();
    long time = System.currentTimeMillis();
    if ((time - timeOfLastInput) < MIN_TIME_INPUT)
    return;
    keyprocessing
    timeOfLastInput = System.currentTimeMillis();
    Now, I have cut it down to only going in a direction once. However, if I press up, down, left, right, (in honor of Konami) My input goes as follow Up (delays MIN_TIME_INPUT) then Down, delays again, left, delays, right.
    And so I am out of ideas.

    haha, this is interesting... a month ago, i had the same problem, until i flash of intellect put me out of my misery...
    rule 1: dont use the time delay. with the processor speed of the cell phones, with your delay, it will take a decade before the app runs...
    heres how to do the coding to keep it to only 1 step at a time: ( i do it in the run method of the thread)
    int originalKey = 0; // keeps the keystates once the execution completes once
    int key = 0; // keeps the keystates for comparision
    while(isRunning) {
        key = getKeyStates();
        if(key == originalKey) {
            originalKey = 0;
            continue;
        if( (key & LEFT_PRESSED) != 0) {
            // do what you want to do, or who you want to do
            originalKey = key;
    // do the same for right pressed and etc etc... this will keep your code from executing too many timesheheh... i think i deserve a few dukes...

  • Flash Action Script Key Press Restrictions

    Hello, so I am making a Pacman game and am using the following script for the movement of my character.
    onClipEvent (enterFrame) {
              speed = 10;
              if (Key.isDown(Key.LEFT))
                        this._x -= speed;
                        _root.char.gotoAndStop(2);
              if (Key.isDown(Key.RIGHT))
                        this._x += speed;
                        _root.char.gotoAndStop(1);
              if (Key.isDown(Key.UP))
                        this._y -= speed;
                        _root.char.gotoAndStop(3);
              if (Key.isDown(Key.DOWN))
                        this._y += speed;
                        _root.char.gotoAndStop(4);
    The problem that I'm having is that when I press the right and down keys, or any other two keys that result in diagonal movement, the character moves in that direction.  I only want the character to be able to move right, left, up and down.  The   _root.char.gotoAndStop(3); part of the script is just so that the character faces in that direction.  Is there any way to restrict the number of keys that can be pressed at once to one? Or to make it so that only the first of the two keys or the second of the two keys pressed is used? If not, is there any way to make a RIGHT and DOWN key press result in diagonal movement that also faces the character that way? Or stops the character entirely? I would throuroughly appreciate any help on the matter! Thanks in advance!
    Walt

    One way would be to incorpate "else" 's for the last three conditionals.  That would make it so that the first key determined to be down would be the key that determines the movement.
    onClipEvent (enterFrame) {
              speed = 10;
              if (Key.isDown(Key.LEFT))
                        this._x -= speed;
                        _root.char.gotoAndStop(2);
              } else  if (Key.isDown(Key.RIGHT))          {
                       this._x += speed;
                        _root.char.gotoAndStop(1);
              } else if (Key.isDown(Key.UP))          {
                        this._y -= speed;
                        _root.char.gotoAndStop(3);
              } else if (Key.isDown(Key.DOWN))           {
                        this._y += speed;
                        _root.char.gotoAndStop(4);

  • How to get the auto increment integer primary key value of a new record

    I have a DB table that has a auto increment integer primary key, if I insert a new record into it by SQL statement "INSERT INTO...", how can I get the integer primary key value of that newly created record?

    Well maybe someone knows a better method, but one workaround would be to add a dummy field to your table. When a new record is inserted this dummy field will be null. Then you can select your record with SELECT keyField FROM yourTable WHERE dummyField IS NULL. Once you've got the key number, you then update the record with a non-null value in the dummyField. Bit of a bodge, but it should work...
    Another alternative is, instead of using an Autonumbered key field, you could assign your own number by getting the MAX value of the existing keys (with SELECT MAX(keyField) FROM yourTable) and using that number + 1 for your new key. Might be a problem if you have lots of records and frequent deletions though.

  • Function Module - Calculate 5 weeks lookup based on -7 increments from the Key Date

    Hi Guys,
    I am looking to create a variable on Fiscal Period/Year, that automatically populates the variable with the previous 5 weeks based on -7 increments from the key date , when the user runs the query .
    For Example: If key date is 03/11/2014 need to get previous 5 weeks 03/04/2014, 02/25/2014, 02/18/2014, 02/11/2014, 02/04/2014. mm/dd/yyyy.
    Is there any Function Module available/ please provide the logic code - can anyone help?
    Thanks,
    Suresh Narayan

    Hi suresh,
    Please once try with this approach,
    Create a variable with variable represents :  multiple input value, Processing type : customer exit ; variable is ready for input.
    and write the below code :
    if i_step = 1.
    data : fdate type d ,
            wa1 like line of e_t_range,
           n1 type i.
    n1 = 1.
    if n1 <= 5.
    wa1-opt = 'EQ'.
    wa1-sign = 'I'.
    wa1-low = fdate.
    append wa1 to e_t_range.
    fdate = fdate - 7.
    endif.
    endif.
    Hope you got it,

  • How do you clear the buffer of excess key presses, in Java?

    Right now, in the game I am working on, if the user presses a key multiple times the actions will be performed as many times as it registers, even though I disallow key presses during the time that the action is taking place.
    For example, a move of 1 space can be carried out with a key press. While the character is moving, key presses are not allowed. However, if you just press the key 5 or 25 times, the character will just keep moving, once he's done with the first one.
    What I need to do is clear the buffer of key presses after an action has taken place, so that the excess keys are not registered. I know the commands to do so in C++, but not in Java.

    Well, I think you've got what I was saying backwards, or I'm not understanding what you are asking correctly.
    it is suppposed to return if isMoving is true, not false. If isMoving is true, it means that the moving animation, and actions are taking place, Which is a process that take about a second, for the player to move one space.
    Here's the code where I process the keypresses
    private void processKey(KeyEvent e) {
        if (isMoving) {return;}
        int keyCode = e.getKeyCode();
        if (!isPaused && !gameOver) {
            isMoving = true;
          if (keyCode == KeyEvent.VK_UP) {
            player.move(player.NE);
          else if (keyCode == KeyEvent.VK_DOWN) {
            player.move(player.SW);
          else if (keyCode == KeyEvent.VK_LEFT) {
            player.move(player.NW);
          else if (keyCode == KeyEvent.VK_RIGHT) {
            player.move(player.SE);
            isMoving = false;
    }And in case I need to clear up what I want to happen, and the results I'm seeing. The player, in this case, moves one space in a direction, with a single press of an arrow key. That functionality is working fine, as intended. However, I don't want you to press the key twice quickly and move two spaces. I don't want you to hold down an arrow key and move continually.
    That part of the functionality is what is not working.
    As I understand my code, pressing the key once should set isMoving to true and, therefore further presses shouldn't register until isMoving is false again, which shouldn't happen until the player moves have finished.
    But, the way that it is working now is that if I press the key 2, 3 or 20 times, as soon as one move is finished another begins. Are the key presses just sitting in the buffer somewhere waiting for isMoving to become false again? And if so, is there a function I can call to clear that buffer after a move is finished?

  • Key Press to Play Video, in multi-screen project

    I have a timeline with multiple videos in it, all loaded as external videos with playback controls as the audio is important (all are 55 seconds long and high quality audio is vital). First of all I want a specific key pressed to play one of the videos. I've been playing around with event handlers, key press event, but nothing has worked.
    This is a multi screen project I'm working on so is there any way to have two seperate windows of video 1080x1920 (that would play on two seperate screens to interact with eachother) or would I have to create a stage twice the width. I need two video clips to play simultaniously once a key is pressed.
    I am a real beginner to flash so I really have no idea whether this is possible.
    I'm doing this on Flash CS6 on a Mac in IOS 10.9.2
    Thanks!

    i'm not sure what you're trying to do with multiple screens but that should have no impact on using key listeners to control your timeline:
    stage.addEventListener(KeyboardEvent.KEY_DOWN,f):
    function f(e:KeyboardEvent):void{
    trace(e.keyCode);

  • Recognizing multiple key presses in As3

    Hi,
    I have a simple game with three keyboard inputs - left, right and fire
    I want to be able to log when a key is pressed and released. In the game, you can be in the following states:
    None
    Left only - keyz on the keyboard
    Right only - keyc on the keyboard
    Fire only - keyx on the keyboard
    Left and Fire - keyz and Keyx on the keyboard
    Right and Fire - Keyc and Keyx on the keyboard
    When Left key is pressed for example, it should log LeftKeypressStart and when it is released, it shoul log leftKeyPressStop. The same should happen to Right and Fire keys when they are pressed individually.
    Now, for the game to be in  Left and Fire state either of the three conditions are true:
    Left key can be pressed and held down before the fire button is pressed and held down or
    Fire button is pressed and held down before left is pressed and held down or
    Both keys pressed down simultenuosly (although this condition will rarely occur as we are not robots)
    Similar conditions should be true for the game to be in the Right and Fire State
    Now considering the first condition,when Left key is down, I want the game to log LeftKeypressStart but as soon as the Fire key is down, it should log LeftKeyPressStop and also Log LeftandFireKeypressStart. Then if Fire is released first, I want it to log LeftandFirKeypressStop and then log LeftKeyStart. but if Left is released first, it should log  LeftandFirKeypressStop and then lof FireKeyPressStart.
    This is what I have at the minute:
    private function onKeyPress (evt:KeyboardEvent)
    if (evt.keyCode == 67 && evt.keyCode !=88 && evt.keyCode != 90)
    //log Right  
    else if (evt.keyCode != 67 && evt.keyCode !=88 && evt.keyCode == 90 )
    //log Left
    else if (evt.keyCode != 67 && evt.keyCode !=90 && evt.keyCode == 88)
    //log Fire
    else if (evt.keyCode == 67 && evt.keyCode !=90 && evt.keyCode == 88 )
    //log RF
    private function onKeyRelease(evt:KeyboardEvent)
    if (evt.keyCode == 67 && evt.keyCode !=88 && evt.keyCode != 90)
    //stop right
    else if (evt.keyCode != 67 && evt.keyCode !=88 && evt.keyCode == 90 )
    //stop Left
    else if (evt.keyCode != 67 && evt.keyCode !=90 && evt.keyCode == 88)
    //stop Fire
    else if (evt.keyCode == 67 && evt.keyCode == 88  && evt.keyCode !=90 )
    // stop RF    

    There can only be one evt.keyCode per keypress, so your approach will not work.  All you need to do is determine which key caused the function to execute.  If you want to keep track of which keys are down, just create three Boolean variables, as in...
    var leftDown:Boolean = false;
    var rightDown:Boolean = false;
    var fireDown:Boolean = false;
    and set those values to true or false and make use of them in whatever other code you intend.
    private function onKeyPress (evt:KeyboardEvent)
    if (evt.keyCode == 67)
                 rightDown = true  
    else if (evt.keyCode ==88)
                 leftDown = true
    else if (evt.keyCode == 88)
                 fireDown = true
    // process per whatever values are true/false
    and in the key up function set them back to false in a similar fashion.

  • Multiple key press's with Bluetooth Keyboard

    I'm ready to update my mac to a new G5 imac and fancy getting the wireless bluetooth keyboard and mouse with it.
    I have one question, has anyone experienced problems when holding down multiple keys on the keyboard and moving the mouse all at once (Using illustrator)?
    In my office I have the misfortune of having to use a PC, I have had a number of wireless keyboard and mouse combos, all of them when using Illustrator and photoshop can not handle multiple key press's and mouse movement.
    ie if I'm duplicating an object by dragging a copy of it across the screen, on the PC it will work but it always "releases" after a couple of seconds and drops the copy in the where I don't want it which gets very frustrating (this only happens with wireless).
    As I do a lot of work at home, I hoping this wont be the case with the mac's bluetooth K & M.
    thanks
    Russell

    The shift key works just fine on my Bluetooth keyboard.  So I would imagine this is an issue with your keyboard.

  • Wish you could tap the Shift key to set next key press in caps on iMac

    I really wish in Mac OS that you could 'tap' the Shift key to set up the next key press in capitals.  In Lion, on my iMac desktop, the present arrangement requires you to hold down the Shift key while hitting the letter you want to capitalise, as has been the case since time began.  On my lovely iPad2, you just tap the shift key once and the next keypress is in caps - SIMPLE and efficient.  I have been yearning for this simple change to the OS since way before the iPad came along, but now you can use it in iOS5 and NOT in Lion, it's really frustrating.  i find i am now failing time after time to select caps in Lion...
    Please, oh wise ones at Apple: take a few minutes out from whatever fresh ramification of iCloud you are concocting and giVe uS bETter cAps.

    There is this, but it might do more than you want:

  • Key press elapsed time

    I'm building a shooting game. I want to record how long the player has the F key pressed in order to use that value to remove ammunition sprites from the stage.
    My application loops in frame 1.
    I have a script that subtracts the key press time from the system time on key release. I think the repeat rate of the keyboard is interfering with this as the output figures are quite random and holding the key down for longer returns a lower number.
    global gFire, gTotal, gStartTime
    on startMovie
      the keyDownScript = "handleKeydown"
      the keyUpScript = "handleKeyUp"
    end startMovie
    --Handler to fire
    on handleKeydown
      if the key = "f" then
        gStartTime = the milliseconds
      end if 
    end handleKeydown
    --Handler to stop firing
    on handleKeyUp
      if the key = "f" then
        gfire = (the milliseconds - gStartTime)/10
        gLeft = gTotal - gFire
        gTotal = gLeft -- gTotal is used to incrementally turn off sprite visibility
        put gfire -- Trace elapsed time to Message window
      end if
    end handleKeyUp
    --This sequence removes bullets from the stage\
    according to he time spent firing
    on enterFrame
      if tTotal < 900 then
        sprite(10).visible = False --this repeated for a sequence of 10 sprites
      end if
    end
    The other problem with this is that it doesn't update the stage till the key is released, so a player can defeat the logic by just holding the key down continuously (especially because the value of gFire doesn't increase as expected)
    Ideally I'd like to record the elapsed time the key is down, add it to a global and have it update the stage at the frame rate, so I guess it would have to be within a frame event handler.
    Any help would be gratefully received.

    MStewart,
    Thanks for doing that. I decided to do a little something like that and just reworked it a bit. Dropped the pause on a case structure and put the timer inside. seemed easier to do it that way for what I wanted to accomplish. The pause is going to be a good thing to have in the event that the heater needs to be turnd off and worked on for any reason, and it won't accrue time or cycles. Used a "in range and coerce" to compare minutes and seconds and then wired a 4 to 15 mA simulated signal to to the timer. All I got to do now is duplicate it 14 more times and then to work on the cDaq part of it to control relays through dig out signals, and sequence the whole thing to write a file for the analog in. Thanks alot for your help and BowenM too. like I said: you guys are awesome. Got me to thinking in other directions.
    Attachments:
    Mexico sentinal loop.vi ‏11 KB
    milliamp timer w pause function.vi ‏24 KB

  • ActiveX is stealing my key presses?

    Hi all,
    I have a fairly simple front panel with a handful of LabVIEW controls and an ActiveX container. In the ActiveX container is the Adobe Reader plugin.
    My vi works, but exhibits an odd behaviour that I presume is focus related. Once the ActiveX control is programmatically told to open and display a pdf file, it seems to steal the focus - permanently. If I select my LV string control, I can select any text in it, but key presses are all still sent to the Adobe Reader ActiveX control. If I click a few check boxes, then the string control again, it still doesn't accept my keyboard presses. The only way I've found to stop all this is to press tab, as this causes LabVIEW to move the focus away to the next control in the tab sequence. After that, all is ok until the next pdf file is read into the ActiveX control, and then I'm back at square one.
    Now I don't want to be telling my customers, "that's alright mate, just make sure you press the tab key after every pdf you generate and you'll be just fine."
    I've tried programmatically moving the focus away from the ActiveX control, and setting "SkipTabbing" to true, but this doesn't work.
    Anyone know how I can prevent this darned ActiveX control from permanently stealing my focus?
    Thoric (CLA, CLED, CTD and LabVIEW Champion)
    Solved!
    Go to Solution.

    nathand wrote:
    Unfortunately I don't have a good solution, but I can sympathize - I've had the same problem.
    Hi nathand, thanks for the sympathy 
    I've tried a few things, including navigating away from and straight back to the tab panel which houses the control to attempt to change the control focus. I've even tried simulating the keyboard TAB key press, which actually works - but only once for some annoyingly unfathomable reason! A second call to the ActiveX AdobeReader control makes it the focus again, but this time permanently. I've even tried putting the ActiveX control into a subvi that's hosted within a subpanel - no difference.
    Ultimately, like yourself, I've had to settle for a separate window, which I've called a Preview Window. Of course, putting my large ActiveX container in a separate subvi has left a dirty big empty space on my main vi front panel 
    I'm tempted to try to hide all borders around the preview window, and programmatically control its location such that it sits perfectly over the empty space within my main front panel. Of course, this means monitoring main panel window resizes and movements to maintain the correct relative locations, but it's do-able...
    I've got a new problem now - I thought about using Invoke to Get the Front Panel Image, then place this into a picture control. However, it seems the AdobeReaderActiveX control evades the LabVIEW Front Panel Image method, revealing nothing but the blank front panel colour behind the container. I can't seem to find a way around this either!
    Dam dam dam dam dam dam dam dam dam dam dam dam!!!
    Thoric (CLA, CLED, CTD and LabVIEW Champion)

  • Where can i learn to handle key presses?

    Right now if I try to hold two keys at once the computer only listens to one of the key presses, and if I am trying to hold a key and release another key at the same time, it only responds to the release. Does anyone know how I can fix these problems or at least point me in the direction of a place I can learn? Right now I have been trying for days and am completely stumped.

    Not sure if this will help or confuse you more but try this:
    1) Run the program as is. Try the left/right arrow keys
    both keyPressed and keyReleased events are generated
    2) Uncomment the line // panel.add(tf). Run again and try the left/right arrow keys
    only the keyReleased event is generated (so the text field is doing something)
    3) Uncomment the remaining lines to override the processKeyEvent of the text field
    Run again and try the left/right arrow keys
    both keyPressed and keyReleased events are generated
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    class TestKeyListener extends JFrame implements KeyListener
         public TestKeyListener()
              setSize(200, 200);
              addKeyListener(this);
              JPanel panel = new JPanel();
              getContentPane().add(panel);
              JTextField tf = new JTextField(10)
    //               public void processKeyEvent(KeyEvent e)
    //                    super.processKeyEvent(e);
    //                    System.out.println(e);
    //          panel.add(tf);
         public void keyTyped(KeyEvent e)
              System.out.println(e);
         public void keyPressed(KeyEvent e)
              System.out.println(e);
         public void keyReleased(KeyEvent e)
              System.out.println(e);
         public static void main(String[] args)
              JFrame frame = new TestKeyListener();
              frame.setDefaultCloseOperation( EXIT_ON_CLOSE );
              frame.setVisible(true);
    Here is another program that gets all events from the AWT event queue. There is a way to set a mask to retrieve only the events you want (ie. key events), but I'm not sure how to do it. If you search the forum you should be able to find an answer.
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    class TestEventQueue extends JFrame
         public TestEventQueue()
              Toolkit.getDefaultToolkit().getSystemEventQueue().push(new MyEventQueue());
              setSize(200, 200);
    //          JTextField tf = new JTextField(10);
    //          getContentPane().add(tf);
         public static void main(String[] args)
              JFrame frame = new TestEventQueue();
              frame.setDefaultCloseOperation( EXIT_ON_CLOSE );
              frame.setVisible(true);
         public class MyEventQueue extends EventQueue
              protected void dispatchEvent(AWTEvent event)
                   super.dispatchEvent(event);
                   System.out.println(event);

  • I want to detect a key press

    To detect a key press, i know i have to use the keylistener class
    public class key implements KeyListener{
         public static void main (String args[]){
              addKeyListener(this);
              keyReleased(KeyEvent e) {}
              keyTyped(KeyEvent e) {}
              keyPressed(KeyEvent e) {
    I built a simple program but it doesn't compile, it has an error.
    All i want is to detect a key press and do something for key presses...
    What am i doing wrong?

    I once got the following demo file somewhere in the Sun/Java site, probably in one of the link cited above..
    * Swing version
    import javax.swing.*;
    import java.awt.event.*;
    import java.awt.BorderLayout;
    import java.awt.Dimension;
    public class KeyEventDemo extends JApplet
                              implements KeyListener,
                                         ActionListener {
        JTextArea displayArea;
        JTextField typingArea;
        static final String newline = System.getProperty("line.separator");
        public void init() {
            JButton button = new JButton("Clear");
            button.addActionListener(this);
            typingArea = new JTextField(20);
            typingArea.addKeyListener(this);
            displayArea = new JTextArea();
            displayArea.setEditable(false);
            JScrollPane scrollPane = new JScrollPane(displayArea);
            scrollPane.setPreferredSize(new Dimension(375, 125));
            JPanel contentPane = new JPanel();
            contentPane.setLayout(new BorderLayout());
            contentPane.add(typingArea, BorderLayout.NORTH);
            contentPane.add(scrollPane, BorderLayout.CENTER);
            contentPane.add(button, BorderLayout.SOUTH);
            setContentPane(contentPane);
        /** Handle the key typed event from the text field. */
        public void keyTyped(KeyEvent e) {
            displayInfo(e, "KEY TYPED: ");
        /** Handle the key pressed event from the text field. */
        public void keyPressed(KeyEvent e) {
            displayInfo(e, "KEY PRESSED: ");
        /** Handle the key released event from the text field. */
        public void keyReleased(KeyEvent e) {
            displayInfo(e, "KEY RELEASED: ");
        /** Handle the button click. */
        public void actionPerformed(ActionEvent e) {
            //Clear the text components.
            displayArea.setText("");
            typingArea.setText("");
            //Return the focus to the typing area.
            typingArea.requestFocus();
         * We have to jump through some hoops to avoid
         * trying to print non-printing characters
         * such as Shift.  (Not only do they not print,
         * but if you put them in a String, the characters
         * afterward won't show up in the text area.)
        protected void displayInfo(KeyEvent e, String s){
            String charString, keyCodeString, modString, tmpString;
            char c = e.getKeyChar();
            int keyCode = e.getKeyCode();
            int modifiers = e.getModifiers();
            if (Character.isISOControl(c)) {
                charString = "key character = "
                           + "(an unprintable control character)";
            } else {
                charString = "key character = '"
                           + c + "'";
            keyCodeString = "key code = " + keyCode
                            + " ("
                            + KeyEvent.getKeyText(keyCode)
                            + ")";
            modString = "modifiers = " + modifiers;
            tmpString = KeyEvent.getKeyModifiersText(modifiers);
            if (tmpString.length() > 0) {
                modString += " (" + tmpString + ")";
            } else {
                modString += " (no modifiers)";
            displayArea.append(s + newline
                               + "    " + charString + newline
                               + "    " + keyCodeString + newline
                               + "    " + modString + newline);
    }

Maybe you are looking for

  • MacBook Pro mid 2010, gray screen at start up, boot from dvd not working.

    Backstory: I was in the process of installing Windows 7 using boot camp, but I was a little bit low on HD space. So, I deleted the user account that had a ton of stuff, and did some other crap that messed up my hard drive. So my computer just won't b

  • Boot camp 2.1 problems, win xp pro sp3

    I have just bought a MBP, 17" and I am running Windows XP Pro, Service Pack 3. With the included boot camp driver everything except the function keys worked. Although the (fn+backspace = delete) worked, no other function keys worked (can't raise or l

  • .fdf from server and .pdf as flex resource

    I'm building an internal app, so I'm not concerned about initial size.  Once developed it should be cached on the local box. I have to generate various 30 page PDF's that are already defined.  I can populate them on the server using a tool like pdftk

  • Connecting to a 27-inch display?

    Can a new Macbook Air connect to a 27-inch Apple display? If so, what adapters do I need? Thanks.

  • You call those music videos?

    I just checked out what music videos are available, and oh my gosh do they suck! SERIOUSLY. Whoever is responsible for them should be canned, or better yet, be forced to work for Microsoft. I know it's early, but where are all the great 80's & 90's v