Receiving keystroke events within an unfocussed java applikation

Hi,
how can I code a Java application, that receives keystroke events, even when the Applikation itself is not focussed.
e.g. my applikation should give me a signal, whenever the "ESC" key was stroked, even when the focus is on another applikation.
Thanks in advance,
Randy

There is no standard way to capture keys destined for another program.
BTW: If you find out how to do this we could all write a small java applet to read passwords/credit card details etc. entered into another screen.

Similar Messages

  • Is it possible to call event within even in Java

    I want to call Mouse Move event in Mouse dragg event, is it possible. Could you please give reference on how to do that.

    The simplistic answer: Yes, if you only want to use some "bland" code in the mouseMoved() method. But I'm not sure how the MouseEvent is set up differently between the two. I would bet that the getPoint() function has useful data in it.
    addMouseMotionListener(new MouseMotionAdapter() {
    @Override
    public void mouseDragged ( MouseEvent e ) {
    this.mouseMoved(e);
    e.consume ();
    @Override
    public void mouseMoved ( MouseEvent e ) {
    mousePos = e.getPoint();
    });

  • Trying to use code found in working PDF from online in LC. (Keystroke Event)

    I found a PDF online (at http://www.planetpdf.com/developer/article.asp?ContentID=javascript_dynamic_updates_w) that works on my iPad running PDF Expert for iPad 5.0.4.
    I tried to recreate it in LiveCycle ES4 using the same code. However, the author says to place the code in the "keystroke" event. I can't find a "keystroke" event. I've tried it and variations in change, preOpen, and exit without any success.
    Can someone help me?
    This is the exact functionality I need and the only example that I have seen work in both a PC environment and an iPad (running PDF Expert).
    Thanks!
    Dan
    The code can be found at: http://www.planetpdf.com/developer/article.asp?ContentID=javascript_dynamic_updates_w
    The sample PDF can be found at: http://www.planetpdf.com/codecuts/pdfs/Populate.pdf
    I am specifically looking at the code in the dropdown box called "Three" - which is captioned as "Dynamic"
    Code follows:
    ==========
    /* This version updates a secondary combobox based on the entry
    ** selected by the user dynamically. The keystroke event should
    ** be processed until the value is about to be committed (as
    ** indicated by event.willCommit). */
    if (!event.willCommit) {
        var f = this.getField("Four");
        f.clearItems();
        /* In a keystroke event, event.change contains the non-export value of the item selected by the user. */
        switch (event.change) {
            case "Cities":
              ;       f.setItems(["Paris", "Berlin", "Amsterdam", "Rome"]);
            break;
            case "Fruit":
              ;       f.setItems(["Bananas", "Mangos", "Strawberries", "Papayas"]);
            break;
            case "Garden Tools":
              ;       f.setItems(["Hoe", "Rake", "Leaf blower", "Shovel"]);
            break;

    The first problem I see is that you are using an old version of WebUtil, which is not supported for use with Forms 10.1.2.3 and is probably the cause of the problem.
    RegisterWebUtil - Loading WebUtil Version 1.0.6
    The correct versions of frmwebutil.jar and webutil.pll are applied to Developer Suite installations and can be copied to Application Server. If you do not have an iDS installation, you can install the latest Forms Bundle patch which includes the correct WebUtil files. Refer to Patch ID 9593176 and Note 1188127.1. Be sure to review the ReadMe included with the patch.
    The second problem is that you are using Jinitiator. Jinitiator has been obsolete for a long time. However, if you have some reason why you must use it, I would recommend that you at least get the last version released (1.3.1.30). This can be downloaded from within MyOracleSupport (account required) using Patch ID 7410076. If you do not have access to MyOracleSupport and you are using Forms 10.1.2.3, then you can use JRE6 (1.6.0_37). Do not attempt to use JRE7
    http://www.oracle.com/technetwork/java/javase/downloads/jre6u37-downloads-1859589.html
    You would need to install the 32bit version: jre-6u37-windows-i586.exe
    References:
    <li>Note: 566628.1
    <li>Note: 561273.1

  • Capturing keystroke event in console-mode

    Hi fellow Java Programmer
    I was stumbled upon what to be a simple question
    Is it possible to capture the keystroke event inside console-based application
    This is my scenario:
    I have a thread that is keep running for a predetermined amount of time,
    It is doing a background-sort-of-task. According to the requirement, it must be able to detect
    when the user press 'R' (which will trigger Reload) or when user press 'Q' (denoting Quit)
    I would appreciate if somebody come up with hint / snippet of source code
    regards,
    Honggo

    try something like this...
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    String s;
    s = br.readLine();
    if(s.equals("R")){
    if(s.equals("R")){
    you also can use s.equalsIgnoreCase("R") if u dont care if its capital or not

  • Socket disconnection event not being reveived java.nio

    Hi All
    My question is as below
    i am using java.nio package + win 2K + jdk1.4.1_02
    I have a Server accepting socket connection and is configured
    in Nonblocking mode.
    -The server receives (selector) events (accept event)
    when a client requests for a connection .
    -The server is getting read and write events when
    client wants to read and write
    -The server gets a read event when the client disconnects
    My only problem is that the Server is not getting any events
    when the client disconnect due to network break down
    for EX when the network connection breaks the client disconnects
    but the server selector is not getting any events
    I am storing the client Socket objects in a Hash Table and
    if i execute the .isConnected() method it returns true
    even though the the client is down
    The only work around is to try to read and write on the socket
    i get an IO exception and am able to make out that the
    client is disconnected
    But this is not desirable for my client
    as client modification to give any kind of echo is not possible and
    a read /write event will cause problem.
    Can any one tell how to detect client side disconnection
    with out Read and Write on the client socket
    I get an socket Exception when the socket is in Blocking IO and is blocked on read/ write but I am facing this problem in NonBlockingIO
    Regards
    Avinash

    int ct = read.selectNow();
    if (ct > 0)
    Set readyKeys = read.selectedKeys();
    Iterator i = readyKeys.iterator();
    while (i.hasNext())
    SelectionKey key = (SelectionKey) i.next();
    i.remove();
    if (key.isReadable())
    SelectableChannel nextReady = (SelectableChannel) key.channel();
    SocketChannel sc = (SocketChannel) key.channel();
    int rd = sc.read(buffer);
    // Link is dead
    if (rd == -1)
    key.cancel();
    key.attach(null);
    nextReady.close();
    continue;
    // Process your data
    catch (Exception e)
    e.printStackTrace();

  • JPanel can't receive key events

    I have a single JPanel added to the content pane of a JFrame.
    I want to itercept key events by adding a KeyListener to the JPanel.
    If I do it, I don't receive key events.
    To solve the problem I identified two ways:
    - add the KeyListener to the JFrame's content pane
    - invoke setFocusable(true) on the JPanel (available only since 1.4)
    I can't use the former because I want to bind the the KeyListener to the JPanel, and I can't use the latter because I don't want to have dependencies on jdk 1.4.
    Can anyone suggest a way to solve the problem as simple as calling setFocusable() but available also for older versions of java?

    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class KeyListenTest {
         public static void main(String[] args) {
              JPanel panel = new JPanel();
              panel.addKeyListener(new KeyAdapter() {
                   public void keyTyped(KeyEvent e) {
                        System.out.println(e);
              JFrame frame = new JFrame();
              frame.getContentPane().add(panel);
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              frame.setSize(400,300);
              frame.setVisible(true);
              panel.requestFocus();
    }The panel must be displayable and visible, so you have to make the call after frame.setVisible(true), however if you don't have any other components that will take the focus away from your panel, this should do it for you. If you want the use to be able to shift focus to your panel, then just add a mouse listener to the panel with a mousePressed(MouseEvent) method that calls the requestFocus() method on the panel.

  • How do I schedule an event within an already scheduled event ?

    I have a business trip coming up for a few days, which I scheduled on my iCal. In the middle of the trip, I have a couple of meetings that I wanted to schedule in as well.
    Uh oh, every time I click on the highlighted dates of travel to create a new event, I find that I can't add anything else during that time. The only thing that comes up is my travel and I am blocked from adding an event within the event, as it were.
    <Edited by Moderator>

    Banktank,
    Welcome to Apple Discussions.
    If you are not being allowed to add/change/edit an event, it indicates that you have an uneditible (Birthday or Subscribed) calendar selected in the CALENDAR Sources pane of the iCal window. Just click on the appropriate calendar to make the change.
    ;~)

  • ICal error "There was a problem receiving this event invitation"

    Whenever I try accepting an event invitation I get a dialog prompt that says
    *There was a problem receiving this event invitation*
    Someone invited you to an event using an email address that isnt on your "me" card in Address Book. Find your email address in the following list and add it to your card in Address Book
    Problem is I've done that, my vCard is up to date. It was working fine, I cant recieve any invites anymore, wether they come from OSX or Windows. Can anyone help?

    I ran into this same issue. To resolve this, go into the Address Book application. Select the vCard that is "your" card. Now in the menu bar, go to "Card". On the drop down menu, select "Make this my card". You should now be able to accept iCal invitations without any issues. When I upgraded to 10.5.1 the issue came back and this method seemed to resolve it.

  • ABAP Webdynpro: Capturing keystroke event

    Hello,
    There is a potential requirement to capture a keystroke event from a SAP standard webdynpro text box and provide a character count in a custom UI display text box on number of characters remaining.
    From initial research - it looks like this may be possible with Unified Rendering Light Speed in WebDynpro ABAP?
    http://help.sap.com/SAPhelp_nw73/helpdata/en/74/0beccf62a7425ab9e1b2077fa1bc6e/frameset.htm
    If it is possible, how exactly would it be implemented.  (Which event / action would be used?) 
    It appears this can be activated and used on existing SAP standard webdynpros? 
    Thank You,
    Mike

    try something like this...
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    String s;
    s = br.readLine();
    if(s.equals("R")){
    if(s.equals("R")){
    you also can use s.equalsIgnoreCase("R") if u dont care if its capital or not

  • Oracle.apps.wf.notification.receive.message event subscription

    Hi,
    I have created a custom test subscription for the above event.I have simply created a rule function which inserts values in a custom table to show that the event is being fired.
    I tested from workflow responsibility, and yes, event is being captured and values are being inserted in the custom table. Means, from test subscription, its working.
    However, now I am trying to respond an notification from email(actual testing of the event). The notificatoin gets processed, but my function is not being called. In other words, possibly my event subscription is not being fired, seeded one is working though.
    I checked WF_NOTIFICATION_IN table. The email responses are received here and their state also shows from 0 to 2 changing. Also, the DEQ_TIME column also has values.
    So the question is how to know why my subscription is not being fired?
    Thanks,
    Abdul Wahid

    One Update.
    I tried to fire some different event and registered this function with that.
    Its working with this event.
    Does that mean that oracle.apps.wf.notification.receive.message event is not being fired?

  • Color coding events within a single calendar

    I need to color code different types of definable events within a single calendar, a feature I have with my old Now Up to Date calendar, but I'm trying to switch over to the Apple calendar.   I understand different calendars will themselves show up as different colors, but this is not what I need.
    Is there a way to do this? If not, is there a  3rd party calendar that is sync-able to multiple devices  that has this feature?
    I'm currently running  OS 10.8.5 on an iMac, 10.1 on a Macbook Air, and OSX 7 on an iPad. I'm waiting to upgrade all to the most recent OS when I am sure I won't need my old versions of software..
    Thanks!

    The color codes are simply a different color for each new calendar you add. I have a mobile me account and it added a few new calendars and each calendar has it's own color so when you view them all it will show you the specific calendar color in which the event is from.

  • Not receiving COMPLETE event in URLLoader

    Hi:
    I'm querying a web application in a remote server through XML files and receiving answers in the same file format. Until now, sometimes I received a connection error:
    Error #2044: Unhandled ioError:. text=Error #2032: Stream Error. URL: http://server/Services/startSesion.com
        at reg_jugadores_fla::MainTimeline/queryGQ()
        at reg_jugadores_fla::MainTimeline/reg_jugadores_fla::frame1()
    When this occurs, trying to access the services through a web browser, there's a test page where you can try queries, returns a "500 Internal server error". I managed that problem adding a listener to catch the error:
    xmlSendLoad.addEventListener(IOErrorEvent.IO_ERROR, catchIOError);
    But since yesterday I can't connect anymore using Flash while it's possible to access the test page. I'm not able to talk to any support guy as the company is closed for vacations! I added listeners to try to know what's happening and this is the result in the output window:
    openHandler: [Event type="open" bubbles=false cancelable=false eventPhase=2]
    progressHandler loaded:154 total: 154
    httpStatusHandler: [HTTPStatusEvent type="httpStatus" bubbles=false cancelable=false eventPhase=2 status=200]
    AFAIK, status=200 means OK but why the COMPLETE event isn't dispatched?. So, is there anything I can do or just wait until the tech guys return from the beach?
    Thanks in advance
    queryGQ(sessionURL,sessionQS);  // Start session
    stop();
    function queryGQ(url:String,qs:String):void {
    var serviceURL:URLRequest = new URLRequest("http://server/Services/"+url);
    serviceURL.data = qs;
    serviceURL.contentType = "text/xml";
    serviceURL.method = URLRequestMethod.POST;
    var xmlSendLoad:URLLoader = new URLLoader();
    configureListeners(xmlSendLoad);
    xmlSendLoad.load(serviceURL);
    function configureListeners(dispatcher:IEventDispatcher):void {
    dispatcher.addEventListener(Event.COMPLETE, loadXML);
    dispatcher.addEventListener(Event.OPEN, openHandler);
    dispatcher.addEventListener(ProgressEvent.PROGRESS, progressHandler);
    dispatcher.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
    dispatcher.addEventListener(HTTPStatusEvent.HTTP_STATUS, httpStatusHandler);
    dispatcher.addEventListener(IOErrorEvent.IO_ERROR, catchIOError);
    function openHandler(event:Event):void {
    trace("openHandler: " + event);
    function progressHandler(event:ProgressEvent):void {
    trace("progressHandler loaded:" + event.bytesLoaded + " total: " + event.bytesTotal);
    function securityErrorHandler(event:SecurityErrorEvent):void {
    trace("securityErrorHandler: " + event);
    function httpStatusHandler(event:HTTPStatusEvent):void {
    trace("httpStatusHandler: " + event);
    function ioErrorHandler(event:IOErrorEvent):void {
    trace("ioErrorHandler: " + event);

    Hugo,
    View may not fire events. View may call method on other controller (component / custom) and this controller fires event.
    You are absolutely right: in WD only instantiated controllers receives the event, event itself does not cause controller instantiation.
    The only controller that is always instantiated is component controller.
    Custom controllers instantiated on demand when their context is accessed or user-defined method called.
    As far as view may not have externally visible context nodes and methods (you may not add view controller as required to other one and use nodes/methods of view), the only time when view is instantiated is when it get visible for first time.
    To solve your problem, try the following:
    1. Save event parameters to component controller context node element before firing event.
    2. Create mapped node in target view and set node from controller as source.
    3. In wdDoInit of target view insert the following code:
    wdThis.<eventHandlerName>(
    null, //no wdEvent
    wdConext.current<NameOfMappedNode>Element().get<NameOfParamA>(),
    wdConext.current<NameOfMappedNode>Element().get<NameOfParamB>(),
    Valery Silaev
    SaM Solutions
    http://www.sam-solutions.net

  • Eventhandlers of children of application can not receive custom event dispatched by application

    Hello dear Adobe community,
    hope you can help me with this issue.
    When the application dispatches a custom event, the child uicomponent can only receive the event by using Application.application.addEventListener or systemManager.addEventListener. Simply adding a listener, without application or systemmanager, does not allow the event to be received by the child component.
    I want to be able to use the addEventListener and removeEventListener without SystemManager or Application.application, or could you provide a better workaround? How can I use the addEventListener, do I need to overwrite EventDispatcher, which I wouldnt like to do?
    Just to clarifiy, if i remove the systemManager in front of addEventListener(CustomEventOne.EventOne,sysManHandleCE,false) it will not add it and will not fire. 
    The code below is an example for this problem that the event is not getting fired in the right moment. The mainapplication got only a button with the customEventOne that gets dispatched.
    public
    class MyCanvas extends Canvas{
    public function MyCanvas()
    super();
    width=300;
    height=300;
    addEventListener(FlexEvent.CREATION_COMPLETE,handleCC,false,0,true);
    private function handleCC(event:FlexEvent):void
    removeEventListener(FlexEvent.CREATION_COMPLETE,handleCC);
    addEventListener(CustomEventOne.EventOne,handleCE,false,0,true);
    addEventListener(Event.REMOVED_FROM_STAGE,handleEvt,false,0,true);
    systemManager.addeventListener(CustomEventOne.eventOne,sysManHandleCE,false,0,true);
    private function handleEvt(event:Event):void
    trace("In removed from stage handler");
    systemManager.removeEventListener(CustomEventOne.EventOne,sysManHandleCE);
    trace(hasEventListener(FlexEvent.CREATION_COMPLETE));
    trace(hasEventListener(CustomEventOne.EventOne));
    trace(hasEventListener(Event.REMOVED_FROM_STAGE));
    private function handleCE(event:CustomEventOne):void
    trace("I got it");
    private function sysManHandleCE(event:CustomEventOne):void
    trace("I got it");
    public class CustomEventOne extends Event
    public static const EventOne:String = "EventOne";
    public function CustomEventOne(type:String, bubbles:Boolean=false, cancelable:Boolean=false)
    super(type, bubbles, cancelable);
    override public functionclone():Event
    return newCustomEventOne(type,bubbles,cancelable);
    Thank you in advance,
    Michael

    I think you need to look at event propogation. The object that dispatches an event will be sitting on the display tree. The event propagates up the tree to the roots. Your canvas should be attached to the application, but even then it sits lower in the tree branches than the event dispatcher, so it won't see the event being dispatched because the event is not propagated to the children of the object that dispatches it but to the parent of the object that dispatches it.
    So, your canvas is a child of the application, but dispatching the event from the application means that the canvas doesn't see it because events are notified up the tree using the parent link, not the child links.
    You may wish to investigate how the display list and event propagation works and then the MVC pattern.
    Paul

  • How to detect keystroke events on the console

    I'm currently implementing a basic menu driven system which needs to
    identify keystroke events (eg. alpha characters). I'm not too sure of the
    best way to deal with this, but can anyone suggest how one could go
    about doing this?
    Cheers,
    Richie !

    If you are refering to the ability to capture user key strokes you will need to add a listener to the class. If is a matter of is it a charater or a number then look into isDigit. Or are you trying to capture Hot-Keys? Please specify and will see if we can help - Bart

  • NetConnection.connected is false upon receiving NetStatus event "NetConnection.Connect.Success"

    I can only reproduce this on Chrome with a non-debug version of Flash.
    I can see that "NetConnection.connected" is still false after receiving NetStatus event "NetConnection.Connect.Success".
    1. I wonder whether this issue only applies to certain versions.
    2. Using a netConnection which is not connected to create a NetStream populates an "arugment error". I wonder what would be the safe thing to do here? Perhaps after receiving the NetConnection.Connect.Success, check "NetConnection.connected" before using it to create the NetStream?

    Are you sure your FMS is up - NetConnection.Connect.Failed comes when  client was not able to reach server kind - which would happen when FMS  is down or your FMS is running on some other machine and your client is  on some other machine as i see you are using localhost. If your FMS is  one "A" machine and your client in on "B" machine please put "ip  address" or "domain name" of "A" machine where FMS is in Netconnection  URI i.e. "rtmp://ipaddressofA/live"
    my fms is on and it is on the same computer as my flash document

Maybe you are looking for

  • Events in classes LabVIEW 8.6

    i have class with some member (counter of something) and i want to generate a user event when this member has specific values. currently i manage to generate the event only if i register the event of the class in the Top Vi that use this class can i

  • Spool settings or programming

    Hi All, i have problem in alv for background processing. In that spool generate Data statistics that not required.. i want in spool Data statistics should not be generate.. like it generate, No of Records Passed & Calculated totals etc. it will be no

  • Sales order availability check considering the ROH stock/procurement time

    Hi Gurus, Our client's Production process requires  the availability check at order level to consider the procurement time required for the Rawmaterial (BOM component of the FERT, whose sales order is taken) in cases when this RM is not available in

  • CS6 Camera Raw Updated to 8.5....now photoshop saying 'file not found'

    So I updated my camera raw for my CR2 files. Now when I try to open my CR2 file it's saying that the 'Camera raw file cannot be found.' I'm extremely confused. I've tried clicking on the Camera Raw plug-in to see what version I have, but it's also gi

  • Problem of blak padding while comparison on nchar column types

    hi i have database oracle 9i with fields of type nchar in tables. in where clause i need to use rtrim(column) = value. if there are spaces they are not trimmed. i am using generic_baseletter and ansi for case insensitive search. see below SELECT * FR