Trying to catch keystrokes

I am trying to write an autonomous KeyCatcher class that I can instantiate anywhere in my application and use it. Unfortunately I am stuck on the very first step. My code looks exactly like the code below. The listener functions are never being called when I hit keys. What am I doing wrong?
Thanks for your help.
[CODE]
var kc:KeyCatcher = new KeyCatcher();
kc.start();
[/CODE]
[CODE]
public class KeyCatcher extends EventDispatcher
        public function KeyCatcher()
        public function start():void{
            addEventListener(KeyboardEvent.KEY_DOWN, catchDownKey);
            addEventListener(KeyboardEvent.KEY_UP, catchUpKey);
        private function catchDownKey(evt:KeyboardEvent):void{
            trace(evt);
        private function catchUpKey(evt:KeyboardEvent):void{
            trace(evt);
[/CODE]

It depends on where you registered your events. I normally listen on systemManager.addEventLIstener for this purpose of listening to the global events, in the main <s:Application file. the example you have does not listen to events on any things, all you are doing is creating an object and adding listener on itself which no one has any idea of who it is.

Similar Messages

  • Trying to catch mouse double click

    Using come code in the API 1.3 documentation, I created a JList and am trying to catch when a user double clicks on an item in the list. I have the following snippet of code:
    public void mouseClicked(MouseEvent e) {
    if ((e.getClickCount() == 3) && (e.getSource() == list1)) {
    int index1 = list1.locationToIndex(e.getPoint());
    System.out.println("Double clicked from the left list on Item " + index1);
    When I double click on an item in list1, it prints out the output line twice as in:
    Double clicked from the left list on Item 1
    Double clicked from the left list on Item 1
    How can I get it to run the code only once. I'm not sure why it's running it twice. Any Ideas would be helpful. Thanks....
    Matt Menard

    I've used similar procedure with success in JDK1.3.1. Without seeing the rest of your code, the only thing left for you to experiment with is to call the consume() method if the count is greater than 1. I did notice that Java mouse event handler leaves much to be desired. For example, the mouseentered and mouseexited events kept getting fired even tho the mouse has entered and never leave.
    V.V.

  • Trying to catch Push-To-Talk button to show a message

    Hello,
    I'm trying to catch the PTT button when someone hit it in my program. Just a simple thing like say "Hi!" when someone press PTT button. But i can't figured out how I could do that!
    thanks

    shouldn't u be returning
      return anyRecords;instead of
      return true; // after the endif????ur method name is confusing I hope this Mysearch() is a TYPO :)
    now that mySearch() returns a boolean depending on whether the query returns something or else u can compare it in jsp using jstl: tags c:equal or c:choose c:when test="" etc etc or as u have done before escape into java itselt using <% // some code in here to get the value from method mySearch()%>

  • My Apple TV 2 is slow when trying to move through different menu selections. It is like a slow computer trying to catch up to mouse clicks. It eventually remembers the buttons that were pushed on the remote, but it freezes and takes a minute to catch up.

    My Apple TV 2 is slow when trying to move through different menu selections. It is like a slow computer trying to catch up to mouse clicks. It eventually remembers the buttons that were pushed on the remote, but it freezes and takes a minute to catch up.

    I had something similar a couple of week ago, it would scroll then stop, scroll then stop.
    At some point the porblem went away.
    Try unpowering and restarting your AppleTV.  Rsetart iTunes too.

  • Trying to catch all exceptions...

    Hi, developers!
    I am trying to develop the best code, that can catch all the exceptions, in the best possible way, and whenever as possible it must register in a log with informations about the exception occurred.
    I need your suggestions. See the code below:
    MyClass()
      throws IOException, MyException {
      Throwable objThrowable1 = null;
      try {
        doSomething();
      } catch(MyException e) {
        objThrowable1 = e;
        throw e;
      } catch(IOException e) {
        objThrowable1 = e;
        throw e;
      } catch(RuntimeException e) {
        objThrowable1 = e;
        throw e;
      } catch(Exception e) {
        objThrowable1 = e;
        throw new Exception("Some Exception occurred.", e);
      } catch(Error e) {
        objThrowable1 = e;
        throw e;
      } finally {
        if (objThrowable1 != null) {
          Throwable objThrowable2 = null;
          try {
            log.fatal(objThrowable1);
            objThrowable1.printStackTrace();
          } catch(RuntimeException e) {
            objThrowable2 = e;
            throw e;
          } catch(Exception e) {
            objThrowable2 = e;
            throw new Exception("Some Exception occurred while logging.", e);
          } catch(Error e) {
            objThrowable2 = e;
            throw e;
          } finally {
            if (objThrowable2 != null) {
              objThrowable2.printStackTrace();
    }It is the constructor of MyClass, and it might throw IOException or MyException.
    Now some questions:
    1) Do you think I exaggerated and wrote a lot of code, more than sufficient?
    2) I wrote all this code because I think it�s a good idea throwing exceptions, especially RuntimeException and Error. The Virtual Machine must know how to handle the situation when some exception occurs. But I want to register a log of the exception, too, whenever as possible. In my opinion, the only way to advise the Virtual Machine that some exception occurred is throwing this exception. Do you agree? Do I really need to worry about it?
    Thanks in advance!

    Hi, developers!
    I am trying to develop the best code, that can catch
    all the exceptions, in the best possible way,Define "best possible way". I don't think what you're proposing is even close, by any measure.
    You should only catch exceptions that you intend to handle. If there's no way for your class to handle the exception, it should bubble it up to the class that will. Catching and rethrowing like that seems a total waste to me.
    I need your suggestions. See the code below:I'd suggest that this is an ugly mess. I would not go this way.
    I have no idea whatsoever about that finally block. That should be for cleanup. What are you doing there?
    MyClass()
    throws IOException, MyException {
    Throwable objThrowable1 = null;
    try {
    doSomething();
    } catch(MyException e) {
    objThrowable1 = e;
    throw e;
    } catch(IOException e) {
    objThrowable1 = e;
    throw e;
    } catch(RuntimeException e) {
    objThrowable1 = e;
    throw e;
    } catch(Exception e) {
    objThrowable1 = e;
    throw new Exception("Some Exception occurred.",
    d.", e);
    } catch(Error e) {
    objThrowable1 = e;
    throw e;
    } finally {
    if (objThrowable1 != null) {
    Throwable objThrowable2 = null;
    try {
    log.fatal(objThrowable1);
    objThrowable1.printStackTrace();
    } catch(RuntimeException e) {
    objThrowable2 = e;
    throw e;
    } catch(Exception e) {
    objThrowable2 = e;
    throw new Exception("Some Exception occurred
    occurred while logging.", e);
    } catch(Error e) {
    objThrowable2 = e;
    throw e;
    } finally {
    if (objThrowable2 != null) {
    objThrowable2.printStackTrace();
    }It is the constructor of MyClass, and it might
    throw IOException or MyException.
    Now some questions:
    1) Do you think I exaggerated and wrote a lot of
    code, more than sufficient?
    2) I wrote all this code because I think it�s a good
    idea throwing exceptions, especially
    RuntimeException and Error. The Virtual
    Machine must know how to handle the situation when
    some exception occurs. But I want to register a log
    of the exception, too, whenever as possible. In my
    opinion, the only way to advise the Virtual Machine
    that some exception occurred is throwing this
    exception. Do you agree? Do I really need to worry
    about it?
    Thanks in advance!Cath t

  • Trying to catch on to using 'discover'

    I am upgrading our Solaris C++ compilation system all the way from SolStudio v6 Update 2 on Solaris 8 to SolarisStudio 12.2 on Solaris 10. (About time, huh?) Things seem to be going well enough but am struggling with the included 'discover' tool. The documentation seems a bit short and its reported "errors" seem rather dubious - but, hey, you learn something every day (especially with C++ ... ;) )
    Suggestions would be appreciated.
    Here is a rather abbreviate example of the type of oddity I am getting. I am writing a small application to test a class named CNCTimeStamp. The class has a fair number of features, but it can be boiled down to this
    nctimestamp.h
    class CNCTimeStamp {
    public:
      CNCTimeStamp();
      virtual ~CNCTimeStamp();
    protected:
      time_t m_timestamp;
      mutable struct tm* m_tm;
    }; // class CNCTimeStampnctimestamp.cpp
    CNCTimeStamp::CNCTimeStamp() :
         m_timestamp(0),
         m_tm(0)
         ::time( &m_timestamp );
    } // CNCTimeStampWhen I build it, using dmake, I get
    berlin{devel}528: dmake test1
    dmake: defaulting to parallel mode.
    See the man page dmake(1) for more information on setting up the .dmakerc file.
    nervecenter --> 1 job
    /opt/solstudio12.2/bin/CC -g -xO2 -I.. -c timetoy.cpp
    nervecenter --> 2 jobs
    /opt/solstudio12.2/bin/CC -g -xO2 -I.. -c ../nctimestamp.cpp
    nervecenter --> 1 job
    /opt/solstudio12.2/bin/CC -g -xO2 -o timetoy timetoy.o nctimestamp.o
    /usr/bin/file timetoy
    /usr/bin/ldd timetoy
    nervecenter --> Job output
    /opt/solstudio12.2/bin/CC -g -xO2 -o timetoy timetoy.o nctimestamp.o
    /usr/bin/file timetoy
    timetoy:        ELF 32-bit LSB executable 80386 Version 1 [FPU], dynamically linked, not stripped
    /usr/bin/ldd timetoy
            libCstd.so.1 =>  /usr/lib/libCstd.so.1
            libCrun.so.1 =>  /usr/lib/libCrun.so.1
            libm.so.2 =>     /usr/lib/libm.so.2
            libc.so.1 =>     /usr/lib/libc.so.1
    nervecenter --> 1 job
    /opt/solstudio12.2/bin/discover -b /opt/firefox4/firefox -H timetoy.html -w timetoy.txt -o timetoy.disc timetoy
    berlin{devel}529:All looks good so far. When I run "timetoy.disc", I get a multitude of "errors". The first is this, which shows enough in its source listing that you can see what's going on. My trouble is in grasping what an "SBR" is and how it would apply. Thoughts?
    I tried this, btw, replacing the "CNCTimeStamp* start = new CNCTimeStamp();" with "CNCTimeStamp start;" to no avail. Same SBR errors. I make no claim to being an expert with C++, but all this seems over the top. Fortunately, I am wrong most of time. LOL
    ERROR 1 (SBR): read from 0x8046ea0 (4 bytes) is beyond stack frame bounds at:
            CNCTimeStamp::CNCTimeStamp #Nvariant 1() + 0x36  <nctimestamp.cpp:37>
                    34:    // -------------------------------------------------------------------
                    35:    // Constructors
                    36:
                    37:=>  CNCTimeStamp::CNCTimeStamp() :
                    38:     m_timestamp(0),
                    39:     m_tm(0)
                    40:    {
            void nap(int) + 0xfa  <timetoy.cpp:11>
                     8:
                     9:    void nap( int naptime )
                    10:    {
                    11:=>           CNCTimeStamp* start = new CNCTimeStamp();
                    12:
                    13:     std::cout << *start << ". Start time." << std::endl;
                    14:
            main() + 0x86  <timetoy.cpp:48>
                    45:
                    46:     for ( int i = 0; i<argc; ++i )
                    47:     {
                    48:=>           nap( argc );
                    49:     }
                    50:
                    51:     timeplus( argc );
            _start() + 0x7c
    ERROR 2 (SBR): read from 0x8046ea0 (4 bytes) is beyond stack frame bounds at:
            CNCTimeStamp::CNCTimeStamp #Nvariant 1() + 0x5c  <nctimestamp.cpp:37>
                    34:    // -------------------------------------------------------------------
                    35:    // Constructors
                    36:
                    37:=>  CNCTimeStamp::CNCTimeStamp() :
                    38:     m_timestamp(0),
                    39:     m_tm(0)
                    40:    {
            void nap(int) + 0xfa  <timetoy.cpp:11>
                     8:
                     9:    void nap( int naptime )
                    10:    {
                    11:=>           CNCTimeStamp* start = new CNCTimeStamp();
                    12:
                    13:     std::cout << *start << ". Start time." << std::endl;
                    14:
            main() + 0x86  <timetoy.cpp:48>
                    45:
                    46:     for ( int i = 0; i<argc; ++i )
                    47:     {
                    48:=>           nap( argc );
                    49:     }
                    50:
                    51:     timeplus( argc );
            _start() + 0x7c
    ERROR 3 (SBR): read from 0x8046ea0 (4 bytes) is beyond stack frame bounds at:
            CNCTimeStamp::CNCTimeStamp #Nvariant 1() + 0x84  <nctimestamp.cpp:39>
                    36:
                    37:    CNCTimeStamp::CNCTimeStamp() :
                    38:     m_timestamp(0),
                    39:=>   m_tm(0)
                    40:    {
                    41:     ::time( &m_timestamp );
                    42:    } // CNCTimeStamp
            void nap(int) + 0xfa  <timetoy.cpp:11>
                     8:
                     9:    void nap( int naptime )
                    10:    {
                    11:=>           CNCTimeStamp* start = new CNCTimeStamp();
                    12:
                    13:     std::cout << *start << ". Start time." << std::endl;
                    14:
            main() + 0x86  <timetoy.cpp:48>
                    45:
                    46:     for ( int i = 0; i<argc; ++i )
                    47:     {
                    48:=>           nap( argc );
                    49:     }
                    50:
                    51:     timeplus( argc );
            _start() + 0x7c
    ERROR 4 (SBR): read from 0x8046ea0 (4 bytes) is beyond stack frame bounds at:
            CNCTimeStamp::CNCTimeStamp #Nvariant 1() + 0xac  <nctimestamp.cpp:39>
                    36:
                    37:    CNCTimeStamp::CNCTimeStamp() :
                    38:     m_timestamp(0),
                    39:=>   m_tm(0)
                    40:    {
                    41:     ::time( &m_timestamp );
                    42:    } // CNCTimeStamp
            void nap(int) + 0xfa  <timetoy.cpp:11>
                     8:
                     9:    void nap( int naptime )
                    10:    {
                    11:=>           CNCTimeStamp* start = new CNCTimeStamp();
                    12:
                    13:     std::cout << *start << ". Start time." << std::endl;
                    14:
            main() + 0x86  <timetoy.cpp:48>
                    45:
                    46:     for ( int i = 0; i<argc; ++i )
                    47:     {
                    48:=>           nap( argc );
                    49:     }
                    50:
                    51:     timeplus( argc );
            _start() + 0x7c
    ERROR 5 (SBR): read from 0x8046ea0 (4 bytes) is beyond stack frame bounds at:
            CNCTimeStamp::CNCTimeStamp #Nvariant 1() + 0xe4  <nctimestamp.cpp:41>
                    38:     m_timestamp(0),
                    39:     m_tm(0)
                    40:    {
                    41:=>   ::time( &m_timestamp );
                    42:    } // CNCTimeStamp
                    43:
                    44:    CNCTimeStamp::CNCTimeStamp( time_t timestamp ) :
            void nap(int) + 0xfa  <timetoy.cpp:11>
                     8:
                     9:    void nap( int naptime )
                    10:    {
                    11:=>           CNCTimeStamp* start = new CNCTimeStamp();
                    12:
                    13:     std::cout << *start << ". Start time." << std::endl;
                    14:
            main() + 0x86  <timetoy.cpp:48>
                    45:
                    46:     for ( int i = 0; i<argc; ++i )
                    47:     {
                    48:=>           nap( argc );
                    49:     }
                    50:
                    51:     timeplus( argc );
            _start() + 0x7cThanks.

    In the interest of helping out. I'll copy/paste here the makefile and source code. If it gets to be too long, I'll have to reply to this reply - and so on.
    There are four pieces: makefile, timetoy.cpp, nctimestamp.h and nctimestamp.cpp. The goal of this exercise has been to port the code base -this C++ class, CNCTimeStamp, is merely a first piece - up to the current Solaris Studio 12.2 C++ environment. At this point I am only using the command-line interface (dmake, dbx, CC). I hope to get to solstudio and dbxtool soon -- they look great!
    makefile
    CCC             = /opt/solstudio12.2/bin/CC
    DISCOVER        = /opt/solstudio12.2/bin/discover
    FILE            = /usr/bin/file
    LDD             = /usr/bin/ldd
    WEBBROWSER      = /opt/firefox4/firefox
    CC_OPTIMIZE     = -m32 -g -xO2
    timetoy: timetoy.o nctimestamp.o
            $(CCC) $(CC_OPTIMIZE) -o $@ timetoy.o nctimestamp.o
            $(FILE) $@
            $(LDD) $@
    timetoy.disc: timetoy
            $(DISCOVER) -w timetoy.txt -o $@ timetoy
    timetoy.o: timetoy.cpp
            $(CCC) $(CC_OPTIMIZE) -I.. -c timetoy.cpp
    nctimestamp.o: ../nctimestamp.cpp
            $(CCC) $(CC_OPTIMIZE) -I.. -c ../nctimestamp.cpp
    clean:
            $(RM) timetoy
            $(RM) timetoy.disc
            $(RM) timetoy.o nctimestamp.o
    test1: timetoy.disc
            ./timetoy.disc 1 1 1timetoy.cpp
    #include <iostream>
    #include <unistd.h>             // sleep(3C)
    #include <inttypes.h>           // int32_t
    #include "nctimestamp.h"
    void nap( int naptime )
            CNCTimeStamp* start = new CNCTimeStamp();
            std::cout << *start << ". Start time." << std::endl;
            sleep( naptime );
            CNCTimeStamp* stop = new CNCTimeStamp();
            time_t mynap = *stop - *start;
            std::cout << *stop << ". That nap was " << mynap << " seconds long." << std::endl;
            delete start;
            start = 0;
            delete stop;
            stop = 0;
    } // nap
    void timeplus( time_t offset )
            CNCTimeStamp now;
            time_t zoom = now.plus( offset );
            CNCTimeStamp* future = new CNCTimeStamp( zoom );
            std::cout << now << " plus " << offset << " is " << *future << std::endl;
            delete future;
    int main( int argc, const char* argv[] )
            int result = EXIT_SUCCESS;
            for ( int i = 0; i<argc; ++i )
                    nap( argc );
            timeplus( argc );
            return result;
    } // mainnctimestamp.h
    #ifndef _NCTIMESTAMP_H_
    #define _NCTIMESTAMP_H_
    #include <iostream>             // std:: ostream
    #include <string>               // std:: string
    #include <ctime>                // std:: time_t, struct tm
    #include <inttypes.h>           // int32_t
    // Class CNCTimeStamp represents a single moment in time.
    // Implementation:
    // 1. The class has two attributes, m_timestamp and m_tm.  The first,
    // m_timestamp, must always be maintained from contruction thru
    // to destruction.  The second, m_tm, is brought into use only
    // as needed; it is entirely secondary to m_timestamp.  The function
    // tm() is called to bring it into existance or return m_tm if it
    // is already created.
    // 2. Reliance on system calls is intentionally limited.  time(2)
    // is called only in the default constructor, which is the means
    // for the client to create an instance set to the present moment
    // in time.  localtime(3c) is used at the point when the m_tm
    // needs to be instantiated.
    class CNCTimeStamp {
    public: // Construction
            CNCTimeStamp();
                    // Represents the current time.
                    // (The moment in time when the instance
                    // is created.)
            CNCTimeStamp( time_t timestamp );
                    // Represents the moment set by 'timestamp'.
            CNCTimeStamp( int year,
                          int month,
                          int day,
                          int hour = 0,
                          int minute = 0,
                          int second = 0,
                          bool* isDST = 0 );
                    // Represents the moment set by the params.
            CNCTimeStamp( const struct tm& tm );
                    // Represents the moment set by the tm struct.
            CNCTimeStamp( const CNCTimeStamp& other );
                    // Copy constructor.
            virtual ~CNCTimeStamp();
    public:
            const CNCTimeStamp& operator = ( const CNCTimeStamp& source );
            const CNCTimeStamp& operator = ( time_t time );
            const CNCTimeStamp& operator = ( const struct tm& tm );
    public: // Output
            std::string YYYYMMDD_HHMMSS() const;
            std::ostream& YYYYMMDD_HHMMSS( std::ostream& os ) const;
                    // Print the time as "yyyy-hh-mm hh-mm-ss"
                    // ex: "2010-01-31 13:59:03"
    public: // Conversion routines (public / static )
            static struct tm* tm( time_t time);
            static time_t time( struct tm* Tm );
    public: // Comparison
            bool operator == ( const CNCTimeStamp& other ) const;
            bool operator == ( time_t timestamp ) const;
            bool operator != ( const CNCTimeStamp& other ) const;
            bool operator != ( time_t timestamp ) const;
            bool operator < ( const CNCTimeStamp& other ) const;
            bool operator < ( time_t timestamp ) const;
            bool operator <= ( const CNCTimeStamp& other ) const;
            bool operator <= ( time_t timestamp ) const;
            bool operator > ( const CNCTimeStamp& other ) const;
            bool operator > ( time_t timestamp ) const;
            bool operator >= ( const CNCTimeStamp& other ) const;
            bool operator >= ( time_t timestamp ) const;
    public: // Comparison
            int delta( const CNCTimeStamp& other ) const;
                    // The amount of time, in seconds, between this
                    // instance and the 'other'. The result can be
                    // positive (future) or negative (past) or
                    // zero (present).
                    // Ex: If both this and other are for the same
                    // minute in time, but 'this' is for the 30th
                    // second and 'other' is for the 44th second,
                    // then the delta is -14 seconds. As in, this
                    // instance is 14 seconds behind the 'other'.
            static int delta( const CNCTimeStamp& first, const CNCTimeStamp& second );
                    // The amount of time, in seconds, between the
                    // 'first' and 'second' instances. The result can be
                    // positive (future) or negative (past) or
                    // zero (present).
                    // Ex: If both 'first' and 'second' are for the same
                    // minute in time, but 'first' is for the 3rd
                    // second and 'second' is for the 13th second,
                    // then the delta is -10 seconds. As in, the
                    // 'first' instance is 10 seconds behind the
                    // 'second'.
    public: // Operations (Addition / Subtraction)
            time_t plus( time_t timespan ) const;
            time_t operator + ( time_t timespan ) const;
            time_t subtract( time_t timespan ) const;
            time_t operator - ( time_t timespan ) const;
            time_t subtract( const CNCTimeStamp& other ) const;
            time_t operator - ( const CNCTimeStamp& other ) const;
    public: // Access
            operator time_t() const;
    protected:
            struct tm* tm() const;
    protected:
            time_t m_timestamp;
            mutable struct tm* m_tm;
    }; // class CNCTimeStamp
    std::ostream& operator<<( std::ostream& os, const CNCTimeStamp& timestamp );
    #endif // _NCTIMESTAMP_H_nctimestamp.cpp
    #include "nctimestamp.h"
    #include <iomanip>
    #include <iostream>
    #include <ctime>        // time_t mktime( struct std::tm* timeptr )
    // Constructors
    CNCTimeStamp::CNCTimeStamp() :
            m_timestamp(0),
            m_tm(0)
            ::time( &m_timestamp );
    } // CNCTimeStamp
    CNCTimeStamp::CNCTimeStamp( time_t timestamp ) :
            m_timestamp( timestamp ),
            m_tm(0)
    CNCTimeStamp::CNCTimeStamp( int year,
                                int month,
                                int day,
                                int hour,
                                int minute,
                                int second,
                                bool* isDST ) :
            m_timestamp(0),
            m_tm(0)
            m_tm = new struct tm;
            memset( m_tm, 0, sizeof( struct tm ) );
            m_tm->tm_year = year - 1900;
            m_tm->tm_mon = month - 1;
            m_tm->tm_mday = day;
            m_tm->tm_hour = hour;
            m_tm->tm_min = minute;
            m_tm->tm_sec = second;
            m_tm->tm_wday = 0; // will be filled out by mktime()
            m_tm->tm_yday = 0; // will be filled out by mktime()
            if ( !isDST )
                    m_tm->tm_isdst = -1;
            else
                    m_tm->tm_isdst = ( *isDST ) ? 1 : 0;
            m_timestamp = mktime( m_tm );   // <ctime> function
    CNCTimeStamp::CNCTimeStamp( const CNCTimeStamp& other ) :
            m_timestamp( other.m_timestamp ),
            m_tm(0)
    CNCTimeStamp::~CNCTimeStamp()
            if ( m_tm )
                    delete m_tm;
                    m_tm = 0;
    } // ~CNCTimeStamp
    // operator =
    const CNCTimeStamp& CNCTimeStamp::operator = ( const CNCTimeStamp& source )
            if ( this != &source )
                    m_timestamp = source.m_timestamp;
                    if ( m_tm )
                            delete m_tm;
                            m_tm = 0;
                    if ( source.m_tm )
                            m_tm = new struct tm( *source.m_tm );
            return *this;
    } // operator =
    // operator =
    const CNCTimeStamp& CNCTimeStamp::operator = ( time_t time )
            m_timestamp = time;
            if ( m_tm )
                    delete m_tm;
                    m_tm = 0;
            return *this;
    } // operator =
    // operator =
    const CNCTimeStamp& CNCTimeStamp::operator = ( const struct tm& tm )
            if ( m_tm )
                    delete m_tm;
                    m_tm = 0;
            m_tm = new struct tm( tm );
            m_timestamp = mktime( m_tm );   // <ctime> function
            return *this;
    } // operator =
    // operator !=
    bool CNCTimeStamp::operator != ( const CNCTimeStamp& other ) const
            return ( m_timestamp != other.m_timestamp ) ? true : false;
    // operator ==
    bool CNCTimeStamp::operator == ( const CNCTimeStamp& other ) const
            return ( m_timestamp == other.m_timestamp ) ? true : false;
    // operator =
    bool CNCTimeStamp::operator != ( time_t timestamp ) const
            return ( m_timestamp != timestamp ) ? true : false;
    // operator =
    bool CNCTimeStamp::operator == ( time_t timestamp ) const
            return ( m_timestamp == timestamp ) ? true : false;
    // operator <
    bool CNCTimeStamp::operator < ( const CNCTimeStamp& other ) const
            return ( m_timestamp < other.m_timestamp ) ? true : false;
    // operator <
    bool CNCTimeStamp::operator < ( time_t timestamp ) const
            return ( m_timestamp < timestamp ) ? true : false;
    // operator <=
    bool CNCTimeStamp::operator <= ( const CNCTimeStamp& other ) const
            return ( m_timestamp <= other.m_timestamp ) ? true : false;
    // operator <=
    bool CNCTimeStamp::operator <= ( time_t timestamp ) const
            return ( m_timestamp <= timestamp ) ? true : false;
    // operator >
    bool CNCTimeStamp::operator > ( const CNCTimeStamp& other ) const
            return ( m_timestamp > other.m_timestamp ) ? true : false;
    // operator >
    bool CNCTimeStamp::operator > ( time_t timestamp ) const
            return ( m_timestamp > timestamp ) ? true : false;
    // operator >=
    bool CNCTimeStamp::operator >= ( const CNCTimeStamp& other ) const
            return ( m_timestamp >= other.m_timestamp ) ? true : false;
    // operator >=
    bool CNCTimeStamp::operator >= ( time_t timestamp ) const
            return ( m_timestamp >= m_timestamp ) ? true : false;
    // plus
    time_t CNCTimeStamp::plus( time_t timespan ) const
            return m_timestamp + timespan;
    } // plus
    // operator +
    time_t CNCTimeStamp::operator + ( time_t timespan ) const
            return plus( timespan );
    } // operator +
    // subtract
    time_t CNCTimeStamp::subtract( time_t timespan ) const
            return m_timestamp - timespan;
    } // subtract
    // operator -
    time_t CNCTimeStamp::operator - ( time_t timespan ) const
            return subtract( timespan );
    } // operator -
    // subtract
    time_t CNCTimeStamp::subtract( const CNCTimeStamp& other ) const
            return (m_timestamp - other.m_timestamp);
    } // subtract
    // operator -
    time_t CNCTimeStamp::operator - ( const CNCTimeStamp& other ) const
            return subtract( other );
    } // operator -
    // tm
    struct tm* CNCTimeStamp::tm() const
            if ( !m_tm )
                    m_tm = tm( m_timestamp );
            return m_tm;
    } // tm
    // tm
    struct tm* CNCTimeStamp::tm( time_t time )
            struct tm* result = new struct tm;
            memset( result, 0, sizeof( struct tm ) );
    #if defined(__unix)
            localtime_r( &time, result );
    #else
            result = localtime( &time );
    #endif
            return result;
    } // tm
    // YYYYMMDD_HHMMSS
    std::string CNCTimeStamp::YYYYMMDD_HHMMSS() const
            struct tm* Tm = tm();
    #if 1
            // format: "yyyy-mm-dd hh:mm:ss" which is a constant 19 chars.
            char buffer[24];
            sprintf( buffer, "%04d-%02d-%02d %02d:%02d:%02d",
                     Tm->tm_year + 1900,
                     Tm->tm_mon + 1,
                     Tm->tm_mday,
                     Tm->tm_hour,
                     Tm->tm_min,
                     Tm->tm_sec );
            std::string result( buffer );
            return result;
    #else
            // This is slow at runtime. The problem is that it
            // relies heavily on the heap for building up its
            // value.
            std::ostringstream result;
            result << std::setfill('0')
                   << std::setw(4) << Tm->tm_year + 1900
                   << "-"
                   << std::setw(2) << Tm->tm_mon + 1
                   << "-"
                   << std::setw(2) << Tm->tm_mday
                   << " "
                   << std::setw(2) << Tm->tm_hour
                   << ":"
                   << std::setw(2) << Tm->tm_min
                   << ":"
                   << std::setw(2) << Tm->tm_sec;
            return result.str();
    #endif
    } // YYYYMMDD_HHMMSS
    // YYYYMMDD_HHMMSS
    std::ostream& CNCTimeStamp::YYYYMMDD_HHMMSS( std::ostream& os ) const
            os << YYYYMMDD_HHMMSS();
            return os;
    } // YYYYMMDD_HHMMSS
    // time
    time_t CNCTimeStamp::time( struct tm* tb )
            return mktime( tb );    // <ctime> function
    // operator time_t
    CNCTimeStamp::operator time_t() const
            return m_timestamp;
    } // operator std::time_t
    // operator<<
    //      Note, there is no 'this' pointer within this function.  Also,
    //      ensure the feature 'YYYYMMDD_HHMMSS' is virtual for all descendents
    //      of CNCTimeStamp.
    std::ostream& operator<<( std::ostream& os, const CNCTimeStamp& timestamp )
            return timestamp.YYYYMMDD_HHMMSS( os );
    } // operator <<
    // ###

  • How to user Error Trigger for mapping - trying to catch row-based errors

    Hello everyone,
    Has anyone managed to use the error trigger for a mapping?
    I created a row based map with the right parameters (i set the error trigger procedure which I already created in the database).
    For this map after run i have 5 warnings which appear in the interface but the error trigger procedure is not executed.
    I set the max errors to 3 so after run the map should end with errors instead of warnings.
    Still not executing the error trigger procedure.
    What am i doing wrong?
    Please help as i really need a way to "catch" row based errors - having multiple target tables sucks.
    Thank you,
    Irina
    Edited by: Irina on Jul 30, 2009 1:32 PM
    Edited by: Irina on Jul 30, 2009 3:38 PM

    It seems nobody knows what I'm talking about - no documentation on it either ... not even in the user guide ... not even on google ... well, just saying what it is doesn't count :D

  • Trying to catch a lion!

    I am trying to upgrade to lion.  The website said I needed to have 10.6.8, I have 10.6.2.  When I update system, it resets, prompts me for my password and everything, but I am still stuck at 10.6.2.  The next step is to go to mac app to dl'd it.  I have no mac app, and the only instructions is to get it by upgrading to 10.6.8.  Please HELP!
    Thanks.

    Download the 10.6.8 combo updater from the Apple Support site and apply it.

  • Catch keystrokes out of focus

    I'm new to event listeners and such. I was curious... is there a way to catch a key combination even when the program is out of focus?
    I've gotten the Robot class to "see" the cursor location even when I was browsing the web.
    My goal is to have an app that will launch a gui at the cursor's location when the user hits "Ctrl + Shift + [Space]", even if the user is in, say, an FPS! :P
    thx in advance for your help! :D

    Some useful information about your topic can be found here:
    http://www.javaworld.com/javaforums/showflat.php?Cat=2&Number=54168&an=0&page=6

  • Problems trying to catch custom exception.

    I am working out of Murach's Java SE 6 and doing one of the excersices. It says to Add a statement to Method3 of CustomTesterApp that throws a TestException without a message. I am getting a CustomTesterApp.java:26: <identifier> expected catch (TestException) error on compile. Here are the two classes. Thanks in advance for any help.
    TestException class
    import java.io.*;
    public class TestException extends Exception
         public TestException(){}
         public TestException(String message)
              super(message);
    CustomTesterApp
    import java.io.*;
    public class CustomTesterApp
        public static void main(String[] args)
            System.out.println("In main: calling Method1.");
            Method1();
            System.out.println("In main: returned from Method1.");
        public static void Method1()
            System.out.println("\tIn Method1: calling Method2.");
            Method2();
            System.out.println("\tIn Method1: returned from Method2.");
        public static void Method2()
            System.out.println("\t\tIn Method2: calling Method3.");
            try
            Method3();
              catch (TestException)
                   System.out.println("TestException caught.");
            System.out.println("\t\tIn Method2: returned from Method3.");
        public static void Method3()
            System.out.println("\t\t\tIn Method3: Entering.");
              throw new TestException();
            //System.out.println("\t\t\tIn Method3: Exiting.");
    }

    That helped a bunch. Also had to modify Method 2. Here is the revised code that works. Thanks for the help.
    import java.io.*;
    public class CustomTesterApp
        public static void main(String[] args)
            System.out.println("In main: calling Method1.");
            Method1();
            System.out.println("In main: returned from Method1.");
        public static void Method1()
            System.out.println("\tIn Method1: calling Method2.");
            Method2();
            System.out.println("\tIn Method1: returned from Method2.");
        public static void Method2()
            System.out.println("\t\tIn Method2: calling Method3.");
            try
            Method3();
              catch (TestException e)
                   System.out.println("TestException caught.");
            System.out.println("\t\tIn Method2: returned from Method3.");
        public static void Method3() throws TestException
            System.out.println("\t\t\tIn Method3: Entering.");
              throw new TestException();
            //System.out.println("\t\t\tIn Method3: Exiting.");
    }

  • Catching multiple keystrokes?

    I have a function that tries to catch multiple key strokes...
    For example, I want to be able to press Alt + 1 and be able to send "hi" to a textInput. I found the code on how to do this on the Adobe site, but it doens't work correctly 100% of the time. Sometimes it will display "hi", other times it will display "1".
    private function keyHandler(event:KeyboardEvent):void {
                    var bShiftPressed:Boolean = event.shiftKey;
                    var bAltPressed:Boolean = event.altKey;
                    if (bAltPressed) {
                        switch(event.keyCode){
                            case Keyboard.NUMBER_1:
                                btnClick('hi');
                            break;
    Does anyone have any idea on how to make this work?

    yep, you'll have to dance around the fact that some key combinations are already defined for browser functionality. When the app gains focus it gains priority over some of them, but not all.
    i have examples of catching multiple key presses(in my example, cntrl+[key]) here
    http://www.mattlefevre.com/viewExample.php?tut=flex&proj=Capturing%20a%20Key%20Press
    but like i mention on that page too, you don't have the full range available to you.

  • JOptionPane and keystroke mappings

    Hi,
    The java doc for JOptionPane gives default keystroke mappings for JOptionPane as:
    "JOptionPane (Java L&F)
    Navigate in/out | Alt+F6
    Retract dialog | Esc
    Activate the default button (if defined) | Enter"
    I have a new class myOptionPane that overrides a number of the functions, and also the creation of the dialog used. Now I'm trying to catch this ESC, and in addition to the dialog retraction do something. Preferably, I could handle the ESC action myself. I tried overriding the processKeyEvent() function for the dialog, and tried adding a KeyListener to the dialog. Neither even caught the event! Its as if JOptionPane just eats up these events leaving no one an option to catch them!
    Any help?? Please!!!
    Shefali

    Hi,
    I created a class for the dialog I am using, and added the key listener in that, and then it works! For whatever reason, adding the key listener to the object wasn't working, I don't know why!!
    But thanks anyways,
    Shefali.

  • Catching TAB event

    Hi all,
    I have a JPanel with a JFormattedTextField inside of it. This field is suposed to receive just dates on it, so I have this method to auto complete the date when I type something.
    private void setDateFieldListeners(final SimpleDateFormat dateFormat) {
          addPropertyChangeListener(new PropertyChangeListener() {
            public void propertyChange(PropertyChangeEvent e) {
              if (e.getPropertyName() == "value") {
                try {      
                  Date date = dateFormat.parse(FormattedDateField.this.getText());
                  if (date != null && DateUtil.getYear(date) < 1000) {
                    date = DateUtil.addYears(date, 2000);
                    FormattedDateField.this.setValue(date);
                catch (ParseException p) {
          addKeyListener(new KeyListener() {
            public void keyPressed(KeyEvent ev) {
            public void keyTyped(KeyEvent ev) {
            public void keyReleased(KeyEvent ev) {
              int code = ev.getKeyCode();
              if (code == KeyEvent.VK_BACK_SPACE ||
                  code == KeyEvent.VK_DELETE) {
                return;
              String date = FormattedDateField.this.getText();
              String format = dateFormat.toPattern();
              int firstBarIndex = format.indexOf("/");
              int firstToSecondBar = -1;
              if (firstBarIndex != -1) {
                String auxString = format.substring(firstBarIndex + 1);
                firstToSecondBar = auxString.indexOf("/");
              if ((date.matches("^[0-9]{" + firstBarIndex + "}") &&
                     date.indexOf("/") == -1) ||
                   (firstToSecondBar!=-1 &&
                     date.matches("^[0-9]{1,}/[0-9]{" + firstToSecondBar + "}"))) {
                FormattedDateField.this.setText(date + "/");
                return;
        }This JPanel is inserted on another panel, and I want the auto complete to happen only when I leave the field.
    I've tried adding a KeyListener to it, so I could filter the auto-complete to happen only when VK_TAB is received, but it seems that java doesn't catches TABs unless I set FocusTraversalKeysEnabled to false (which I don't want to).
    I also tried to catch it by overriding the method getFocusTraversalKeys like that:
    public Set getFocusTraversalKeys (int id) {
        if (id==KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS ||
            id==KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS) {
          //autocomplete
        } return super.getFocusTraversalKeys(id);
      }This also seems not to work, cuz any key I press, this method is called 3 times, receiving 0, 1 and 2 as id and KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS is 0.
    Does anybody has another idea on catching the TAB?

    read:
    http://java.sun.com/docs/books/tutorial/uiswing/misc/k
    eybinding.html
    note the 4 examples at the end which you can probably
    cut and paste.I've tried the examples, but still not getting anything.
    Here's the code I've used:
    getInputMap().put(KeyStroke.getKeyStroke("TAB"), "Move Focus Forwards");
    getActionMap().put("Move Focus Forwards", nextFocusAction);The code above is on the class constructor. nextFocusAction is:
    private Action nextFocusAction = new AbstractAction("Move Focus Forwards") {
          public void actionPerformed(ActionEvent evt) {
            System.out.println("entered here");
            ((Component) evt.getSource()).transferFocus();
        };The println never prints...
    Am I missing something?

  • Getting alpha bates using barcode sanner and KeyStroke.getKeyStroke

    Hi,
    I am trying to catch all the keys from barcode scanner. But it is not getting all the keys. I am able to get all the numerics but I am not getting any alpha bates. If barcode says A01, I am getting 01 only.
    Here is my code:
    private void MyKeyMap() {
            JRootPane rootPane = this.getRootPane();
            InputMap iMap = rootPane.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
            ActionMap aMap = rootPane.getActionMap();
            iMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "escape");
            aMap.put("escape", new AbstractAction() {
                public void actionPerformed(ActionEvent e) {
                    dispose();
            iMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "enter");
            aMap.put("enter", new AbstractAction() {
                public void actionPerformed(ActionEvent e) {
                    System.out.println("Enter");
            iMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_NUMPAD1, 0), "1");
            aMap.put("1", new AbstractAction() {
                public void actionPerformed(ActionEvent e) {
                    System.out.println("1");
            iMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_NUMPAD2, 0), "2");
            aMap.put("2", new AbstractAction() {
                public void actionPerformed(ActionEvent e) {
                    System.out.println("2");
            iMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_NUMPAD3, 0), "3");
            aMap.put("3", new AbstractAction() {
                public void actionPerformed(ActionEvent e) {
                    System.out.println("3");
            iMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_NUMPAD4, 0), "4");
            aMap.put("4", new AbstractAction() {
                public void actionPerformed(ActionEvent e) {
                    System.out.println("3");
            iMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_NUMPAD5, 0), "5");
            aMap.put("5", new AbstractAction() {
                public void actionPerformed(ActionEvent e) {
                    System.out.println("5");
            iMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_NUMPAD6, 0), "6");
            aMap.put("6", new AbstractAction() {
                public void actionPerformed(ActionEvent e) {
                    System.out.println("6");
            iMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_NUMPAD7, 0), "7");
            aMap.put("7", new AbstractAction() {
                public void actionPerformed(ActionEvent e) {
                    System.out.println("7");
            iMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_NUMPAD8, 0), "8");
            aMap.put("8", new AbstractAction() {
                public void actionPerformed(ActionEvent e) {
                    System.out.println("8");
            iMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_NUMPAD9, 0), "9");
            aMap.put("9", new AbstractAction() {
                public void actionPerformed(ActionEvent e) {
                    System.out.println("9");
            iMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_NUMPAD0, 0), "0");
            aMap.put("0", new AbstractAction() {
                public void actionPerformed(ActionEvent e) {
                    System.out.println("0");
            iMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_1, 0), "1");
            aMap.put("1", new AbstractAction() {
                public void actionPerformed(ActionEvent e) {
                    System.out.println("1");
            iMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_2, 0), "2");
            aMap.put("2", new AbstractAction() {
                public void actionPerformed(ActionEvent e) {
                    System.out.println("2");
            iMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_3, 0), "3");
            aMap.put("3", new AbstractAction() {
                public void actionPerformed(ActionEvent e) {
                    System.out.println("3");
            iMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_4, 0), "4");
            aMap.put("4", new AbstractAction() {
                public void actionPerformed(ActionEvent e) {
                    System.out.println("4");
            iMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_5, 0), "5");
            aMap.put("5", new AbstractAction() {
                public void actionPerformed(ActionEvent e) {
                    System.out.println("5");
            iMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_6, 0), "6");
            aMap.put("6", new AbstractAction() {
                public void actionPerformed(ActionEvent e) {
                    System.out.println("6");
            iMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_7, 0), "7");
            aMap.put("7", new AbstractAction() {
                public void actionPerformed(ActionEvent e) {
                    System.out.println("7");
            iMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_8, 0), "8");
            aMap.put("8", new AbstractAction() {
                public void actionPerformed(ActionEvent e) {
                    System.out.println("8");
            iMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_9, 0), "9");
            aMap.put("9", new AbstractAction() {
                public void actionPerformed(ActionEvent e) {
                    System.out.println("9");
            iMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_0, 0), "0");
            aMap.put("0", new AbstractAction() {
                public void actionPerformed(ActionEvent e) {
                    System.out.println("0");
            iMap.put(KeyStroke.getKeyStroke("A"), "A");
            aMap.put("A", new AbstractAction() {
                public void actionPerformed(ActionEvent e) {
                    System.out.println("A");
            iMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_B, 0), "b");
            aMap.put("b", new AbstractAction() {
                public void actionPerformed(ActionEvent e) {
                    System.out.println("B");
            iMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_C, 0), "c");
            aMap.put("c", new AbstractAction() {
                public void actionPerformed(ActionEvent e) {
                    System.out.println("C");
            iMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_D, 0), "d");
            aMap.put("d", new AbstractAction() {
                public void actionPerformed(ActionEvent e) {
                    System.out.println("D");
            iMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_E, 0), "e");
            aMap.put("e", new AbstractAction() {
                public void actionPerformed(ActionEvent e) {
                    System.out.println("E");
            iMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_F, 0), "f");
            aMap.put("f", new AbstractAction() {
                public void actionPerformed(ActionEvent e) {
                    System.out.println("F");
            iMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_G, 0), "g");
            aMap.put("g", new AbstractAction() {
                public void actionPerformed(ActionEvent e) {
                    System.out.println("G");
            iMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_H, 0), "h");
            aMap.put("h", new AbstractAction() {
                public void actionPerformed(ActionEvent e) {
                    System.out.println("H");
            iMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_I, 0), "i");
            aMap.put("i", new AbstractAction() {
                public void actionPerformed(ActionEvent e) {
                    System.out.println("I");
            iMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_J, 0), "j");
            aMap.put("j", new AbstractAction() {
                public void actionPerformed(ActionEvent e) {
                    System.out.println("j");
            iMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_K, 0), "k");
            aMap.put("k", new AbstractAction() {
                public void actionPerformed(ActionEvent e) {
                    System.out.println("K");
            iMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_L, 0), "l");
            aMap.put("l", new AbstractAction() {
                public void actionPerformed(ActionEvent e) {
                    System.out.println("L");
            iMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_M, 0), "m");
            aMap.put("m", new AbstractAction() {
                public void actionPerformed(ActionEvent e) {
                    System.out.println("M");
            iMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_N, 0), "n");
            aMap.put("n", new AbstractAction() {
                public void actionPerformed(ActionEvent e) {
                    System.out.println("N");
            iMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_O, 0), "o");
            aMap.put("o", new AbstractAction() {
                public void actionPerformed(ActionEvent e) {
                    System.out.println("O");
            iMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_P, 0), "p");
            aMap.put("p", new AbstractAction() {
                public void actionPerformed(ActionEvent e) {
                    System.out.println("P");
            iMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_Q, 0), "q");
            aMap.put("q", new AbstractAction() {
                public void actionPerformed(ActionEvent e) {
                    System.out.println("q");
            iMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_R, 0), "r");
            aMap.put("r", new AbstractAction() {
                public void actionPerformed(ActionEvent e) {
                    System.out.println("R");
            iMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_S, 0), "s");
            aMap.put("s", new AbstractAction() {
                public void actionPerformed(ActionEvent e) {
                    System.out.println("S");
            iMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_T, 0), "t");
            aMap.put("t", new AbstractAction() {
                public void actionPerformed(ActionEvent e) {
                    System.out.println("T");
            iMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_U, 0), "u");
            aMap.put("u", new AbstractAction() {
                public void actionPerformed(ActionEvent e) {
                    System.out.println("U");
            iMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_V, 0), "v");
            aMap.put("v", new AbstractAction() {
                public void actionPerformed(ActionEvent e) {
                    System.out.println("V");
            iMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_W, 0), "w");
            aMap.put("w", new AbstractAction() {
                public void actionPerformed(ActionEvent e) {
                    System.out.println("W");
            iMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_X, 0), "x");
            aMap.put("x", new AbstractAction() {
                public void actionPerformed(ActionEvent e) {
                    System.out.println("X");
            iMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_Y, 0), "y");
            aMap.put("y", new AbstractAction() {
                public void actionPerformed(ActionEvent e) {
                    System.out.println("Y");
            iMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_Z, 0), "z");
            aMap.put("z", new AbstractAction() {
                public void actionPerformed(ActionEvent e) {
                    System.out.println("Z");
            iMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_UP, 0), "up");
            aMap.put("up", new AbstractAction() {
                public void actionPerformed(ActionEvent e) {
            iMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0), "down");
            aMap.put("down", new AbstractAction() {
                public void actionPerformed(ActionEvent e) {
            iMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SPACE, 0), "bspace");
            aMap.put("bspace", new AbstractAction() {
                public void actionPerformed(ActionEvent e) {
        }

    My immediate first impression is that you are probably not recieving an upper-case letter. The JavaDocs for KeyEvent.VK_A says:
    VK_A thru VK_Z are the same as ASCII 'A' thru 'Z' (0x41 - 0x5A)
    Those letter, if I am not mistaken, are 'A-Z'. You mentioned that numbers work fine, so it has to be how the event is coming in.
    My suggestion is that you add some debug statements in to print out the value of of the KeyStroke being sent. You are getting something weird in there, I would be willing to bet.

  • How to catch error message inside a variable?

    Hi,
    I'm trying to catch the error message inside a variable using this this command below:-
    <%=odiRef.getPrevStepLog("MESSAGE")%>
    Could you please tell me what is the right approach to capture the error message inside a variable.
    Thanks
    Anindya

    Hi Bhabani,
    I have done this and select an oracle schema.But the variables only captures the (null).Please look into this.You must have one step prior to this refresh variable. Then only it can get the status as given below.
    Returns the one-letter code indicating the status with which the previous step terminated. The state R (Running) is never returned.
    D: Done (success)
    E: Error
    Q: Queued
    W: Waiting
    M: Warning
    If you want the complete error details then you will face issues in case of multi line message. For this best option would be jython variable.Could please provide me some idea how to use this jython variable.I will update you on this soon
    Thanks
    Anindya

Maybe you are looking for

  • Generic Guide to fix Thinkpad issues.

    Hey there. This is a small guide I threw together to help solve some generic issues that are encountered on T series Thinkpads: No audio/choppy audio: Reinstall audio driver No video out/improper resolution and no video acceleration: Reinstall graphi

  • Is it possible to make an multi-protocol IM in JAVA ???

    Is it possible to make an multi-protocol IM in JAVA ( like "pidgin IM") for the simultaneous chat with yahoo,MSN,gtalk rediff,XMMP clients IM. I m a newbie in java and know java up to Awt , IO & Exception handling. what concept I have to learn for ma

  • 11g BPM Composer on Solaris soooo slow

    Hi guys, We really want to use BPM Process Composer, so we installed SOA Suite 11.1.1.3 on a Solaris machine (Sun SPARC Enterprise T5440) with plenty of memory and cpu available. However it takes over 5 minutes just to login. We found by doing thread

  • Useless rotate in QT pro

    I have the common problem of needing to rotate video shot the wrong way in my digital camera so I bought QT pro (I'd always wondered what you might use it for). The problem is it rotates the whole movie not just the data within the frame - if I now t

  • Wakes from sleep then sleeps again

    Hi there, I've posted a message previously on these boards asking a question about a sleep problem, wherein my iBook wouldn't wake from sleep and had to be forced shutdown to restart. This was resolved with the help of these boards in the form of a k