Send a keypress event to JOptionPane ?

How can I send a keypress event to JOptionPane emulating the "No" selection?
Thanks
Andreia

Actually...I thot about it...and you would not even have to do that....if the timer goes off....and the user did not select "yes", then you just call the method that would have been called when "no" was pressed.....simple.

Similar Messages

  • Keypress Events

    Hi, everybody, it is my first question to you all.
    Does anybody have any function that would capture keypress events, or
    any information that would be helpful in capturing them? For example,
    when a user presses the <down arrow> or F1 key. I am currently using
    the AfterValueChange event to capture keys that display.
    Thanks,
    Scott Watters
    Systems Analyst
    Carlson Wagonlit Travel - Minneapolis
    [email protected]

    Hi, Scott.
    Here's the information I found on trapping keystrokes - mostly R3 =
    specific, but that's OK for you. I pulled the following posts off my =
    mailing list archive:
    From: <[email protected]>
    Date: Fri, 4 Apr 1997 15:57:32 +0800
    Subject: Trapping Certain Keystrokes
    Hi All,
    I have read the manuals, and the online-documentation, but can not seem =
    to find anything about trapping keystrokes other than the Function keys.
    Our application specifically requires us to trap certain keystrokes, =
    such as the navigation keys etc.=20
    Does anybody know which event is raised when a key is pressed?
    Any insight will be appreciated.
    Regards Martin
    From: DEVEAUX Manuel <[email protected]>
    Date: Fri, 4 Apr 1997 11:43:11 +0200
    Subject: RE: Trapping Certain Keystrokes
    Hi all,
    Actually, I don't think you can trap keystrokes on a UserWindow but on =
    some WidGets (like DataFields), you can set to TRUE the 'Validate on =
    KeyStroke' option in the properties dialog .
    Thus, when the WidGet has the focus and the user send a keystroke, you =
    can trap this event with the 'AfterValueChange' event. If someone knows
    =
    how to trap keystrokes on a UserWindow, I am also interested !
    Thanks.
    * Manuel -
    Manuel Deveaux
    Fort=E9 Developer
    Mutuelle Pr=E9viade
    Nancy, FRANCE
    E-Mail : [email protected]
    From: Jean-Paul De Baets <[email protected]>
    Date: Fri, 04 Apr 1997 14:11:58 +0200
    Subject: RE: Trapping Certain Keystrokes -Reply
    This is an enhancement request we also posted several months ago. I =
    think it is announced for Fort=E9 release 3. But I don't know if we =
    will be able to trap ANY keystroke.
    Jean-Paul=20
    J.P. De Baets
    CAP GEMINI Belgium
    [email protected]
    From: Kerry Bellerose <[email protected]>
    Date: Fri, 04 Apr 1997 13:28:14 +0100
    Subject: Re: Trapping Certain Keystrokes
    Hi Manuel and Martin,
    Unfortunately, for Forte V2.0, Manuel is correct. But Forte has added a
    =
    feature that allows you to trap any keystroke in Forte R3, which is =
    currently in beta.
    If you are a beta site, look in the Forte Release 3 Beta Features manual
    =
    page 169, the window class SetAsFunctionKey method.
    If you are not a beta site and want this functionality in R2,=20
    you would need to do some tricks with menus or data fields, as Manuel =
    indicated.
    Cheers,
    Kerry
    From: Lee Wei <[email protected]>
    Date: Mon, 7 Apr 97 09:06:23 PDT
    Subject: RE: Trapping Certain Keystrokes -Reply
    I think all of us want to know if we can indeed trap ANY keys.
    The answer is ALMOST, including escape, spacebar, enter, backspace, tab,
    =
    navigational (up,down,left,right,end,home), digits, alpha, numeric =
    keypads, insert, delete.
    But not keys such as left shift, right shift, left Alt, right Alt, left =
    Ctrl, and right Ctrl (Helpful for games...).
    Don't forget that we are talking about release 3.
    Lee Wei
    Hope this helps,
    Dariusz Rakowicz
    [email protected]
    From: owner-forte-users
    Sent: Friday, July 25, 1997 10:46 AM
    To: 'Forte Users Group'
    Subject: Keypress Events
    Hi, everybody, it is my first question to you all.
    Does anybody have any function that would capture keypress events, or
    any information that would be helpful in capturing them? For example,
    when a user presses the <down arrow> or F1 key. I am currently using
    the AfterValueChange event to capture keys that display.
    Thanks,
    Scott Watters
    Systems Analyst
    Carlson Wagonlit Travel - Minneapolis
    [email protected]

  • List that responds to keypressed events?

    Hi
    I am designing a midlet that needs a list which scrolls down to names based on the input from the phones letter keys (ie if the user presses the 'GHI' key then the names starting with 'G' are shown. the same as in a phones contact-list) However the problem is that there is no keypressed event for j2me Lists or Forms.
    I realy don't want to have to reinvent the List from a Canvas.
    Could anyone tell me the best way to handle this?
    Thanks greatly
    Aharon

    Hmm... the small screen is a big pain, isn't it!
    Suppose you dynamically filter the list of potential entries based on what has been already entered in the TextField? Something like thisString[] allNames = new String[100];
    choiceGroup.deleteAll();
    String filter = textField.getString().trim().toUpperCase();
    for ( int i = 0; i < allNames.length; i++ )
        if ( allNames.toUpperCase().startsWith(filter))
    choiceGroup.append ( allNames[i], null );
    }db
    -- TextField, [i]not TextBox.  TextBox extends Screen, TextField extends Item. ;-)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Listening for keyPressed events from background?

    Is it possible to have a java program running in the background and listen for keyPressed events? I would like for the program to listen for certain keys to be pressed and when they are manipulate the mouse. From what I've looked at so far however it seems the listening component must have focus. Thanks.

    On any OS that would typically involve hooking into the OS itself.
    And then manipulating OS resources as well.
    Putting an app into the 'background' is also OS specific.
    Given that the above is all you want to do then java is not an appropriate language choice. C++ would be better.

  • How can i call mouse click event from keypress event???

    How can i call mouse click event from keypress event???
    I want same GUI changes to be occured at key press.....i.e . button going down & comming up.....
    for calculator

    Put all the code that happens on those events into a method. Then call that method from both events.

  • Can one get keyPressed events anywhere other than in Canvas?

    Hi there,
    I have a form displayed
         display.setCurrent(form);
    but I would like to receive keyPressed events, in particular "game actions" UP DOWN LEFT RIGHT.
    As far as I can tell, this isn't possible unless I have a Canvas displayed. :-(
    The form is displaying data (a couple of string items) and the soft key commands.
    This is only my second MIDP app, so any help would be appreciated.
    Thanks,
    colin

    1. Don't know.
    2. Hopefully you have a backup to restore from. Contacts are separate from iTunes, but if you enabled iCloud, then your contacts should be preserved (if you do not use Outlook, Address Book, etc.)

  • KeyPressed Event in Swing

    In keyPressed Event Iam calling dispatchEvent on the component passing the ActionEvent as argument.
    Iam expecting that, control should come back to actionPerformed as it happens in awt.
    But, it is not behaving like that. Can u guys figure it out Y??
    Here is my sample code:
    public void CancelButtonPressed () {
    ActionEvent actionEvent = new ActionEvent((Object)CancelButton,
         ActionEvent.ACTION_PERFORMED, CStrings.CANCEL);
    CancelButton.dispatchEvent (actionEvent);
    Note: CancelButton is my JButton object instance.
    Iam expecting that after dispatchEvent is called as above java should invoke actionPerformed.
    But it is not.

    I need to construct ActionEvent explicity since actionlisteners are set for the components in one class say A.
    From this class keypressed event is delegated to the other class say b.
    Here B class gets the component. Inour case its JButton. In class B, i cannot call the actionPerformed.
    What I do is.. I will call the dispatchEvent on this component. Thats why Iam creating ActionEvent.
    I hope you got my point.

  • Getting Error : Exception sending context initialized event to listener

    I am using JWSDP1.2 and tomcat that's bundled with it.
    I am trying out a simple jsf appln very similar to the "Usernamebean" example.Each time i deploy my war file and try to access my webapp, i get the following error in tomcat's log. Driving me nuts !
    Jun 12, 2003 12:23:04 AM org.apache.catalina.core.StandardHostDeployer install
    INFO: Installing web application at context path /finaljsf from URL jar:file:/C:/jwsdp-1.2/webapps/finaljsf.war!/
    Jun 12, 2003 12:23:05 AM org.apache.catalina.core.StandardContext listenerStart
    SEVERE: Exception sending context initialized event to listener instance of class com.sun.faces.config.ConfigListener
    javax.faces.FacesException: javax.faces.application.ApplicationFactory
         at javax.faces.FactoryFinder.getImplementationName(FactoryFinder.java:400)
         at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:203)
         at com.sun.faces.config.ConfigParser.parseConfig(ConfigParser.java:91)
         at com.sun.faces.config.ConfigListener.contextInitialized(ConfigListener.java:127)
         at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3670)
         at org.apache.catalina.core.StandardContext.start(StandardContext.java:4106)
         at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:843)
         at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:827)
         at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:623)
         at org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.java:315)
         at org.apache.catalina.core.StandardHost.install(StandardHost.java:837)
         at org.apache.catalina.manager.ManagerServlet.install(ManagerServlet.java:712)
         at org.apache.catalina.manager.HTMLManagerServlet.install(HTMLManagerServlet.java:306

    I was using an older version of tiles.jar. Hence the error. Started working after I moved to the latest version of struts.jar

  • Sending Virtual Keypress while locking out peripherials

    I am working on a 2010 LV program to mitigate operator errors--pretty simple; mainly manipulating a third party executable window (TPEW).  However, my program (MP) works great but has a huge, basic flaw that I am sure there is a simple solution?  Without a solution, unfortunately, correct operation of MP relies on the premise the user will not touch any peripherals; not very reliable when MP is supposed to add process control—LOL.  After the user scans a few barcodes into MP, MP activates opens/activates the TPEW, sends virtual key presses (VKPs), using user32.dll commands—typical method I think, to “type” the name of a particular graphics file (and other info) into the TPEW data fields.  MP works like a champ, unless the user clicks the mouse (deactivates the TPEW) or hits the actual keyboard (extraneous keys corrupt the laser marking graphics file name MP is “typing” in).  MP needs to periodically disable the peripherals, but at the same time, be able to send VKPs.  GIVEN THIS METHOD (user32.dll) OF SENDING VKPs OR ANY OTHER, CAN PERIPHERALS BE DISABLE BY AT THE SAME TIME VKPs ARE SENT USING LV?  I searched the entire internet, but have not found a solution.
    Shannon F
    Solved!
    Go to Solution.

    I am researching autoit, but don't quite get it yet.  Do you know if I add send key commands using API calls, where you specified to enter my code, will it be blocked by the autoit block?  Please see example code in jpeg I posted below, using API disable input. My prob is if I disable input using API, it also disables my keypresses sent via API.  I am kinda thinking disabling via autoit will have the same problem.  Maybe I need to figure out another method to send virtual keypresses, though I don't have a clue what would work other than sending via API as I am.
    I hope this works, or I may be SOL.  I just need to do a bit more research to see how to configure it.
    Regards,
    Shannon
    Shannon F
    Attachments:
    block input via API blocks API keypresses too.JPG ‏81 KB

  • SEVERE: Exception sending context initialized event to listener instance

    Hi,
    I am seeing the following error when trying to deploy my war file using tomcat 6.0.18. War file is built with JSF 1.2 and Java 1.6.0_12. Could anyone please let me know what could be the reason.
    Thanks.
    Jun 12, 2009 3:09:37 PM com.sun.faces.config.ConfigureListener contextInitialized
    WARNING: JSF1059: WARNING! The com.sun.faces.verifyObjects feature is to aid developers not using tools. It shouldn''t be enabled if using an IDE, or if this application is being deployed for production as it will impact application start times.
    Jun 12, 2009 3:09:37 PM org.apache.catalina.core.StandardContext listenerStart
    SEVERE: Exception sending context initialized event to listener instance of class com.sun.faces.config.ConfigureListener
    com.sun.faces.config.ConfigurationException: CONFIGURATION FAILED! cvc-elt.2: The value of {abstract} in the element declaration for 'faces-config' must be false.
         at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:213)
         at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:196)
         at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843)
         at org.apache.catalina.core.StandardContext.start(StandardContext.java:4342)
         at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
         at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
         at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
         at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:830)
         at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:719)
         at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:490)
         at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1149)
         at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
         at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
         at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
         at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
         at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
         at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
         at org.apache.catalina.core.StandardService.start(StandardService.java:516)
         at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
         at org.apache.catalina.startup.Catalina.start(Catalina.java:578)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:597)
         at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
         at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
    Caused by: org.xml.sax.SAXParseException: cvc-elt.2: The value of {abstract} in the element declaration for 'faces-config' must be false.
         at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)
         at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:131)
         at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:384)
         at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:318)
         at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(XMLSchemaValidator.java:410)
         at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.reportSchemaError(XMLSchemaValidator.java:3165)
         at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:1951)
         at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.startElement(XMLSchemaValidator.java:685)
         at com.sun.org.apache.xerces.internal.jaxp.validation.DOMValidatorHelper.beginNode(DOMValidatorHelper.java:273)
         at com.sun.org.apache.xerces.internal.jaxp.validation.DOMValidatorHelper.validate(DOMValidatorHelper.java:240)
         at com.sun.org.apache.xerces.internal.jaxp.validation.DOMValidatorHelper.validate(DOMValidatorHelper.java:186)
         at com.sun.org.apache.xerces.internal.jaxp.validation.ValidatorImpl.validate(ValidatorImpl.java:100)
         at javax.xml.validation.Validator.validate(Validator.java:127)
         at com.sun.faces.config.ConfigManager$ParseTask.getDocument(ConfigManager.java:434)
         at com.sun.faces.config.ConfigManager$ParseTask.call(ConfigManager.java:394)
         at com.sun.faces.config.ConfigManager$ParseTask.call(ConfigManager.java:351)
         at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
         at java.util.concurrent.FutureTask.run(FutureTask.java:138)
         at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
         at java.lang.Thread.run(Thread.java:619)

    More logs:
    Jun 12, 2009 3:09:37 PM org.apache.catalina.core.StandardContext listenerStart
    SEVERE: Exception sending context initialized event to listener instance of class com.sun.faces.config.ConfigureListener
    com.sun.faces.config.ConfigurationException: CONFIGURATION FAILED! cvc-elt.2: The value of {abstract} in the element declaration for 'faces-config' must be false.
         at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:213)
         at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:196)
         at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843)
         at org.apache.catalina.core.StandardContext.start(StandardContext.java:4342)
         at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
         at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
         at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
         at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:830)
         at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:719)
         at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:490)
         at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1149)
         at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
         at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
         at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
         at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
         at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
         at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
         at org.apache.catalina.core.StandardService.start(StandardService.java:516)
         at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
         at org.apache.catalina.startup.Catalina.start(Catalina.java:578)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:597)
         at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
         at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
    Caused by: org.xml.sax.SAXParseException: cvc-elt.2: The value of {abstract} in the element declaration for 'faces-config' must be false.
         at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)
         at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:131)
         at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:384)
         at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:318)
         at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(XMLSchemaValidator.java:410)
         at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.reportSchemaError(XMLSchemaValidator.java:3165)
         at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:1951)
         at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.startElement(XMLSchemaValidator.java:685)
         at com.sun.org.apache.xerces.internal.jaxp.validation.DOMValidatorHelper.beginNode(DOMValidatorHelper.java:273)
         at com.sun.org.apache.xerces.internal.jaxp.validation.DOMValidatorHelper.validate(DOMValidatorHelper.java:240)
         at com.sun.org.apache.xerces.internal.jaxp.validation.DOMValidatorHelper.validate(DOMValidatorHelper.java:186)
         at com.sun.org.apache.xerces.internal.jaxp.validation.ValidatorImpl.validate(ValidatorImpl.java:100)
         at javax.xml.validation.Validator.validate(Validator.java:127)
         at com.sun.faces.config.ConfigManager$ParseTask.getDocument(ConfigManager.java:434)
         at com.sun.faces.config.ConfigManager$ParseTask.call(ConfigManager.java:394)
         at com.sun.faces.config.ConfigManager$ParseTask.call(ConfigManager.java:351)
         at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
         at java.util.concurrent.FutureTask.run(FutureTask.java:138)
         at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
         at java.lang.Thread.run(Thread.java:619)

  • Alt+ key in KeyPressed Event

    hi,
    I would like to get the KeyPressed Event for 'Alt+O' keyEvents. How to find two keystrokes combined. thanks in advance.

    You may want to read the KeyEvent class description in the API documentation.
    http://java.sun.com/j2se/1.4/docs/api/java/awt/event/KeyEvent.html

  • Xquery Sender with External event receiver

    Hi,
    I am using a Xquery sender with external event receiver automation plugin.
    I want to use following functions in the same XQuery,
    1. automator:getOrderAsDOM($automator)
    2. automator:setSetJMSMessageText($automator, fn:false())
    But both these functions belong to different namespaces,
    declare namespace automator = "java:oracle.communications.ordermanagement.automation.plugin.*ScriptReceiverContextInvocation*";
    declare namespace automator = "java:oracle.communications.ordermanagement.automation.plugin.*ScriptSenderContextInvocation*";
    How can I declare these above namespaces in the same Xquery for using the above mentioned functions?
    Please help.

    To add to c.w.'s comments note that starting in 7.0.3 we have added support for additional automation context API functions that accept/return DOM natively. This saves the hassle of having to manually write the code to parse the serialized XML order into a DOM and also offers some additional efficiencies performance wise.
    This means with 7.0.3 you can access the order as follows:
    let $order := context:getOrderAsDom($context)
    There are similar API's to update the order (updateOrderAsDom) and to make an API call (processXMLRequestDom).
    Regards,
    Brian.

  • How to handle keypressed event for form

    i have to handle keypressed event of a textfield control.
    I have tried by implementing itemstatechangelistner ........
    but as api specifies its behavior varies from device to device....it is guaranteed that the control is notified when losing its focus. But my requirement is to get notified for every keypressed time.....
    any idea.....pls help me

    Can't be done for TextField. Many devices (example:SE k700i) launch a separate editing screen to change the text in a TextField.
    db

  • Adf javascript clientlistener not capturing the TAB keypress event

    Hi,
    I have client listener attached to a text field to trap the keyPress event. The method is being called for all the key strokes except special keys like TAB, arrow keys, pageup, pagedown etc. Is there any possibility to capture TAB key event.
    <af:clientListener method="myFunctionTosetFocus"
    type="keyPress"/>
    function myFunctionTosetFocus(event) {
    alert('function called....')
    var keyCodePressed = event.getKeyCode();
    if(keyCodePressed == AdfKeyStroke.ENTER_KEY || keyCodePressed == AdfKeyStroke.TAB_KEY) {
    alert('Do some thing here....')
    I can see both the alert messages when I click on the ENTER key. But I cannot see both the alert messages when I cick on TAB key. The same is working without any problems in firefox.
    Thanks and Regards,
    S R Prasad

    Hi Frank,
    I tried with the event.cancel(). Now I can see the event.cancel() working for ENTER key, But not for the TAB key. I tried with the keyDown event in the clientListener and it is working with out any problems in both IE and firefox.
    It is not working as expected in case of keyUp event, If I set the focus to the next tab in the clientListener code, it is executing the clientListener of the destination component if the clientListener event is keyUp.
    Overall it is wotking as expected with the keyDown, But it is not working for the keyUp and keyPress events. All these are working as expected in firefox.
    Thanks and Regards,
    S R Prasad

  • JTree - How do I fire a valueChange Event from a keyPressed Event?

    Hi,
    I have been stumped trying to figure out how to fire a valueChange event in my JTree from a keyPressed event.
    When a user changes tree node using the mouse a valueChange event fires. In my program the valueChange executes some code that must be done. I want to get my JTree to work, so that if a user is nagivating the tree using the keyboard, the code is only executed if they press the enter key.
    Below is a little demo program of what I am attempting to accomplish. Any suggestions would be greating appriciated.
    Thanks,
    Corey
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.KeyEvent;
    import java.awt.event.KeyListener;
    import java.awt.event.MouseAdapter;
    import java.awt.event.MouseEvent;
    import javax.swing.tree.*;
    import javax.swing.event.*;
    public class SimpleTreeDemo extends JFrame  {
      public SimpleTreeDemo() {
      public static void main(String args[]) {
        JFrame j = new SimpleTreeDemo();
        DefaultMutableTreeNode category = new DefaultMutableTreeNode("Top of JTree");
        DefaultMutableTreeNode leaf1 = new DefaultMutableTreeNode("leaf1");
        DefaultMutableTreeNode leaf2 = new DefaultMutableTreeNode("leaf2");
        category.add(leaf1); category.add(leaf2);
        final JTree jtree = new JTree(category);
        boolean bflag = false;
        jtree.addTreeSelectionListener(new TreeSelectionListener() {
             public void valueChanged(TreeSelectionEvent e) {
                  System.out.println("valueChanged");
                  if (bflag)
                       // Execute Code
        jtree.addKeyListener(new KeyListener() {
            public void keyTyped(KeyEvent ke) {
              System.out.println("keyTyped");
            public void keyPressed(KeyEvent ke) {
                 System.out.println("keyPressed");
                 if (ke.getKeyCode() == KeyEvent.VK_ENTER)
                      bflag = true;
                    // Fire valueChanged here!
            public void keyReleased(KeyEvent ke) {
                 System.out.println("keyReleased");}
        Container c = j.getContentPane();
        c.add(jtree);
        j.setSize(200,200);
        j.show();

    Try this, it works for me.
    // Tree Key Listener
          tree.addKeyListener(new java.awt.event.KeyAdapter() {
             public void keyPressed(KeyEvent e) {
                tree_KeyReleased(e);
    private void tree_KeyReleased(KeyEvent e) {
          try {
          int keyCode = e.getKeyCode();
          // Get the Tree Path
          TreePath selPath = tree.getSelectionPath();
          if (keyCode == e.VK_DELETE) { //KeyCode - 127
             removeSelectedNode(); // Remove the node
          else if (keyCode == e.VK_ADD) { // Key Code - 107
             tree.expandPath(selPath); // Expand the Node
          else if (keyCode == e.VK_SUBTRACT) { // Key Code 109
             tree.collapsePath(selPath); // Collapse the Node
          else if (keyCode == e.VK_ENTER) {
              // What Ever you want to do here
          else {
          } catch (NullPointerException ex) {
          //System.out.println("Null");
    [/code                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Maybe you are looking for

  • Customisation of goods issue,goods receipt,transfer posting,stock transfer

    hi, how to do customisation of goods issue,goods receipt,tranfer posting and stock transfer. thanks katrina

  • Can acrobat print the entire contents of a scrollable input frames?

    Hello, I am working on a mac and using InDesign CC 2014 and Acrobat XI Pro. I have created an interactive form in InDesign and exported it as a interactive PDF. I have created scrollable input frames. Great for input, and on the screen in general, bu

  • How to set a @age id to an item

    Hi, Could you please how I can set a page id to an item on the page? I have tried to create a tree using the following query on page 1, and also I have create a item P1_SCID:- === select "SCID" id, "CID" pid, "SUBCATEGORY" name, 'f?p=105:&PAGE_ID.'||

  • How to connect microsoft sql with java servlets

    what are steps i should do after writing servlet program to connect with microsoft sql. what coding should i add in web.xml file.if any other steps mention it. i didn't get output or err msg in browser.if i should install jdbc drivers seperately for

  • Localization of adf faces-config.xml

    I have defined my ADF process train component and menu items in my faces-config.xml. The definition has got the label for these components in the faces-config.xml How can I localize these labels so that I can support multiple languages. The managed b