Problem in Tab Keys

Hi
I am trying to write a KeyListener that can detect when the tab key is pressed within a JTextField. The Listener detects all keys accept the tab key. It seems that some lower level method is consuming the key before it get to my listener.
My application needs to put up a dialog if the tabs out of the text field.
Any help would be appreciated.

Hi,
Yes, there is a lower-level method that dispatches all events generated from a component and sends the events to the appropriate listener for that component.
You need to subclass JTextField and override processKeyEvent(KeyEvent key). Any type of key event generated from this component, this method will dispatch the event to all of this components key listeners, so there will be some processing that blocks the TAB key.We can override the method and perform our own processing, and then call super.processKeyEvent(KeyEvent) to handle all other key events other than TAB.
Try the below code this showa how to catch the TAB key .
class CustomTextField extends JTextField {
public CustomTextField( int c){
super(c);
protected void processKeyEvent(KeyEvent ke){
if( ke.getKeyCode() == KeyEvent.VK_TAB)
System.out.println("TAB");
//you must call this!!
super.processKeyEvent( ke);
Hope this will help you.
Anil
Developer Technical Support,
Sun Microsystems Inc,
http://www.sun.com/developers/support

Similar Messages

  • Problem with tab-key navigation

    I am making chanegs to an existing form.
    I have a tab canvas with 3 tabs, each contains a data block, and other data blocks outside of the tab canvas.
    I wanted the tab key to move the cursor to the next record so I changed the navigation style from "Change Block" to "Change Record", but it did not help. When the cursor is a on a record of a multi-record block and I tab through the items to the last one, pressing the tab key leads me to another tab-page.
    I put in some debug code and noticed that the WHEN-TAB-CHANGED trigger did not fire. The WHEN-VALIDATE-RECORD trigger fired and the cursor block and record number were correct.
    After the tab key took me to another tab-page and I navigated back to the original tab-page. Even though it looks like I'm on the correct tab page, SYSTEM.cursor_block was NOT correct, it was pointing to another data block outside of the tab canvas.
    I checked other forms on our system and I'm pretty sure that changing the navigation style to "Change Record" would work. Perhaps there's something peculiar about this form.
    Any idea will be appreciated.
    Thanks.

    Found the problem.
    For some reason, the WHEN-NEXT-ITEM trigger of the last item of the record is hard-coded to go the another block.

  • ITunes problem with tab key

    After an iTunes update on my iMac, I can no longer use the tab key to move from one box to another (Artist>Song>Album). Has anyone else had similar problems?

    Hi,
    looking at other threads, I think you will
    have to get the button and modify/remove the tool tip
    as you which.
    this thread might help you, at least the way to get the components in the file
    chooser:
    http://forum.java.sun.com/thread.jsp?forum=57&thread=563002

  • Problem with Tab Key in JFileChooser when Details view is selected.

    Hi all,
    Iam using a JFileChooser in my application.When i click Details option in the JFileChooser the files with the size,Type and modified date are displayed.
    When i am using tab to navigate through the JFileChooser,when the tab enters the area where the files are listed with details,the tab is not comming out of the File List area,instead it is traversing with in the files.How do i come out of the File List area using Tab key.I wanted to make a functionality similar to Windows FileChooser where in if we press Tab it goes to the file list and the next tab focus to Text field and so on.
    Is it possible using JFileChooser??
    Pls Help me,
    Thanks and Regards,
    Ravi

    Hi,
    looking at other threads, I think you will
    have to get the button and modify/remove the tool tip
    as you which.
    this thread might help you, at least the way to get the components in the file
    chooser:
    http://forum.java.sun.com/thread.jsp?forum=57&thread=563002

  • Problem with Tab key

    Hi all,
    I have a swing appication run JDK1.3.1. I try to run on JDK1.4.2 is OK, but TAB key isn't available from this component to other component.
    Any suggestion would be appreciated.
    Thanks in advance.

    Component can JButton, JTextField, JComboBox...
    Not at all Dialogs error with tab key, but when open Dialog that is'nt available with tab key then next dialogs is'nt available too althought they available with tab key.

  • Since installing LTR 5.4, which I've now upgraded to 5.6, I've encountered repeated slowness and malfunctions in operations, especially when using the Compare View function and the Tab key to open and close the right and left side panels.  Such problems n

    Since installing LTR 5.4, which I've now upgraded to 5.6, I've encountered repeated slowness and malfunctions in operations, especially when using the Compare View function and the Tab key to open and close the right and left side panels.  Such problems never arose during two years of using LTR-4 and nothing else has changed on my computer.  I have a pretty simple system with only a few plug-ins, which are usually not in operation.  I have 12GB of RAM in my Windows 7 PC.  I could illustrate these problems with screen shots if you would tell me how to submit screen shots.  Otherwise I will try to describe the problems in words.
    The problem is clearly cumulative, growing worse as usage time passes.  Compare View feature gradually slows down and eventually seems to choke as my work session proceeds. If I Exit LTR and re-enter and start all over, things will work normally for maybe 30 minutes, but then the Compare View feature begins to become very slow to respond.   In a recent example with my screen full of thumbnails in Library mode I highlighted two images to compare. LTR started to open the Compare View screen by first having the top row of thumbnails disappear to be replaced by the "SELECT" and "CANDIDATE" words in their spaces  (but no images), but Compare View never succeeded in gaining control of the screen. After some seconds the top row of thumbnails reasserted its position and the Compare View windows disappeared. But LTR kept trying to bring them back. Again the top row of thumbnails would go away, Select and candidate would reappear, try again, and give up. This went on for at least 2-3 minutes before I tried to choose File and Exit, but even that did not initially want to respond. It doesn't like to accept other commands when it's trying to open Compare View. Finally it allowed me to exit.
    To experiment I created a new catalog of 1100 images.  After 30-40 minutes, the Compare View function began to operate very slowly. With left and right side panels visible and two thumbnails highlighted, hitting Compare View can take half a minute before the two mid-size  images open in their respective SELECT and CANDIDATE windows. When the side panels are open and two images are in the Select/Candidate spaces, hitting the Tab button to close the side panels produces a very delayed response--25-30 seconds to close them, a few more seconds to enlarge the two images to full size. To reverse the process (i.e., to recall the two side panels), hitting Tab would make the two sides of the screen go black for up to a minute, with no words visible. Eventually the info fields in the panels would open up.
    I also created a new user account and imported a folder of 160 images. After half an hour Compare View began mis-placing data.  (I have a screen shot to show this.)  CANDIDATE appears on the left side of SELECT, whereas it should be on the right. The accompanying camera exposure data appears almost entirely to the left of the mid-screen dividing line. Although the Candidate and Select headings were transposed, the image exposure data was not, but the data for the image on the right was almost entirely to the left of the line dividing the screen in two.
    Gurus in The Lightroom Forum have examined Task Manager data showing Processes running and Performance indicators and they see nothing wrong.  I could also send screen shots of this data.
    At this point, the only way I can process my images is to work 30-40 minutes and then shut down everything, exit, and re-start LTR.  This is not normal.  I hope you can find the cause, and then the solution.  If you would like to see my screen shots, tell me how to submit them.
    Ollie
    [email protected]

    Since installing LTR 5.4, which I've now upgraded to 5.6, I've encountered repeated slowness and malfunctions in operations, especially when using the Compare View function and the Tab key to open and close the right and left side panels.  Such problems never arose during two years of using LTR-4 and nothing else has changed on my computer.  I have a pretty simple system with only a few plug-ins, which are usually not in operation.  I have 12GB of RAM in my Windows 7 PC.  I could illustrate these problems with screen shots if you would tell me how to submit screen shots.  Otherwise I will try to describe the problems in words.
    The problem is clearly cumulative, growing worse as usage time passes.  Compare View feature gradually slows down and eventually seems to choke as my work session proceeds. If I Exit LTR and re-enter and start all over, things will work normally for maybe 30 minutes, but then the Compare View feature begins to become very slow to respond.   In a recent example with my screen full of thumbnails in Library mode I highlighted two images to compare. LTR started to open the Compare View screen by first having the top row of thumbnails disappear to be replaced by the "SELECT" and "CANDIDATE" words in their spaces  (but no images), but Compare View never succeeded in gaining control of the screen. After some seconds the top row of thumbnails reasserted its position and the Compare View windows disappeared. But LTR kept trying to bring them back. Again the top row of thumbnails would go away, Select and candidate would reappear, try again, and give up. This went on for at least 2-3 minutes before I tried to choose File and Exit, but even that did not initially want to respond. It doesn't like to accept other commands when it's trying to open Compare View. Finally it allowed me to exit.
    To experiment I created a new catalog of 1100 images.  After 30-40 minutes, the Compare View function began to operate very slowly. With left and right side panels visible and two thumbnails highlighted, hitting Compare View can take half a minute before the two mid-size  images open in their respective SELECT and CANDIDATE windows. When the side panels are open and two images are in the Select/Candidate spaces, hitting the Tab button to close the side panels produces a very delayed response--25-30 seconds to close them, a few more seconds to enlarge the two images to full size. To reverse the process (i.e., to recall the two side panels), hitting Tab would make the two sides of the screen go black for up to a minute, with no words visible. Eventually the info fields in the panels would open up.
    I also created a new user account and imported a folder of 160 images. After half an hour Compare View began mis-placing data.  (I have a screen shot to show this.)  CANDIDATE appears on the left side of SELECT, whereas it should be on the right. The accompanying camera exposure data appears almost entirely to the left of the mid-screen dividing line. Although the Candidate and Select headings were transposed, the image exposure data was not, but the data for the image on the right was almost entirely to the left of the line dividing the screen in two.
    Gurus in The Lightroom Forum have examined Task Manager data showing Processes running and Performance indicators and they see nothing wrong.  I could also send screen shots of this data.
    At this point, the only way I can process my images is to work 30-40 minutes and then shut down everything, exit, and re-start LTR.  This is not normal.  I hope you can find the cause, and then the solution.  If you would like to see my screen shots, tell me how to submit them.
    Ollie
    [email protected]

  • Problem: do something, if jumping in another textfield through tab-key

    hi,
    please, maybe can anybody help me.....
    I've got some textfields (JTextField) in a swing-application. by jumping in another textfield through pressing the tab-key, something should happen.
    I wrote the following code, but it doesn't works ;-(
    textfieldReleaseOf.addKeyListener(new KeyAdapter() {
    public void keyPressed(KeyEvent e) {
    if (e.getKeyCode() == KeyEvent.VK_TAB ) {
    System.out.println("tabspr...................");
    else {
    System.out.println("kein tabspr...................");
    thanks for helping......

    From your problem description it seems that you need to do something not only when the user presses TAB but also if the user switches to some other textfield. Although it could be accomplished using the KeyListener as you have already done, a better way would be to use the FocusListener. You can add a FocusListener to your JComponent (or JTextField) object. It will fire events whenever the user presses tab to move onto the next field and even when the user clicks on the next field using a mouse.

  • Java Applet problem in Internet Explorer 7 with Tab Key

    Hi
    I am developing some web pages in which iam using a java applet. so far the intended user are supposed to be using Internet Explorer 7. the problem i am facing is that when i press the tab key within the applet. the control get transferred to new tab position in the web page outside the applet and i have to click back to the applet to get control again transferred to the applet.
    i want to restrict the control of tab so that when tab is pressed within the applet the tab should not move to next tab position in the page and remain confined within the applet.
    Can someone please help me how can i achieve this and whether i have to do coding for it in the applet or in the web page...so that within the applet the Internet Explorer tab control should remain disabled..

    Hello all,
    I have the same problem, but I don't found a solution. Could you resolved the problem and who??
    Thank you.
    Jorge

  • 10.10.3 caps lock and tab key problems

    Since I upgraded to 10.10.3 I've had no tab key or caps lock. No one else has written about this. Am I the only one having these problems?
    I guess I will take the keyboard home to try with a different Mac.

    Hi venustas,
    It sounds like you updated your computer and now 2 keys do not appear to be working. You should use this section of the following article to troubleshoot that:
    OS X Yosemite: If keys on your keyboard don’t work
    If other keys don’t work
    You may have accidentally set an option that changes how your keyboard operates.
    Choose Apple menu > System Preferences, click Dictation & Speech, then click Text to Speech. If “Speak selected text when the key is pressed” is selected, deselect it or click Change Key to select another key. 
    Choose Apple menu > System Preferences, click Accessibility, then click Keyboard. Make sure Slow Keys is turned off. If Slow Keys is on, you must hold down a key longer than usual before it’s recognized. 
    Choose Apple menu > System Preferences, click Accessibility, then click Mouse & Trackpad. Make sure Mouse Keys is off. If Mouse Keys is on, pressing keys in the numeric keypad moves the pointer instead of entering numbers. 
    Choose Apple menu > System Preferences, click Keyboard, then click Input Sources. Select “Show Input menu in menu bar.” Open the Input menu, then make sure the correct keyboard layout is selected. 
    To see the keyboard layout, click Keyboard, then choose “Show Keyboard & Character Viewers in menu bar.”
    Thank you for using Apple Support Communities.
    Regards,
    Sterling

  • PJC tab-key navigation problem within bean  (FORMS intercepting tab key??)

    Using Forms 10.1.2.3, IE7, JRE 1.6
    When attempting to navigate within the bean area, it appears as if FORMS is suppressing the keyEvent when the tab key is pressed. This means that I cannot use tab or shift-tab to navigate within the PJC's editable fields/buttons. I can click on them, enter data within them, but tab is somehow intercepted. When I place my PJC within a normal (non-forms) Java window, everything works fine.
    Documentation that I've read seems to indicate that tab should navigate perfectly fine within the bean area.
    Any ideas?

    Hi,
    This is how I did it. Sorry about the formatting, it was OK when I pasted the code fragment in.
    My class contains this in the variable definitions.
    private AWTEventListener keyListener = new DoKey ();
    private class DoKey implements AWTEventListener {
    public void eventDispatched (AWTEvent e) {
    //System.err.println("eventDispatched " + e.toString());
    //System.err.println("eventDispatched source " + e.getSource().toString());
    if ((e instanceof KeyEvent) && (e.getSource() instanceof Component)) {
    * The event was a key pressed event and it was sourced from a Component.
    KeyEvent evt = (KeyEvent) e;
    if (evt.getID() == evt.KEY_PRESSED) {
    if (evt.getKeyCode() == evt.VK_TAB) {
    if (evt.isShiftDown()) {
    ((Component)e.getSource()).transferFocusBackward();
    else {
    ((Component)e.getSource()).transferFocus();
    The listener is enabled when on initialisation
    Toolkit.getDefaultToolkit().addAWTEventListener (keyListener, AWTEvent.KEY_EVENT_MASK);
    Regards, Tony C

  • Compatible IE8 - tab key Problem

    Hi all
    i need navigate through fields by tab key.
    i have several lov in my form (jspx) and use IE8 as my browser and jdeveloper 11.1.1.3.0.
    in IE8, when user enter value in lovs and press tab , focus will lose and next field will not be active.
    but if mark Tools\Compatibility view , tab key is ok.
    how can i set compatible in my project ?

    Hi,
    not sure there is anything we can do against this in the product. However, if you have a simple testcase with instructions how to reproduce the defect then I can file a bug on your behalf. My mail address is in my otn profile. Please attach the sample (based on teh HR scheme if you need a database) to the mail and rename the zip to ".unzipme"
    Frank

  • Problem with tabs in xml text

    I have a problem with my XML setup here
    i use Tab key to aligh up info in the xml text for aligned
    display in the program
    hoever i tested on several computers and get different
    resolts.
    how can i fix this.
    Please view the linked Image
    http://img129.imageshack.us/img129/8394/flashtextproblemti4.jpg
    this is what happenes even thow all run xp and all run same
    latest flash version.
    Anyone got an ideer how i can solve this.
    BTW the font is verdana.
    This is my actionscript ....
    // Function to parse an address
    f_parseAddress = function () {
    // Set the text
    _root.stageholder.textfield.htmlText =
    this.firstChild.firstChild.firstChild.nodeValue;
    // Create the XML object
    XML_address = new XML();
    // Set up the XML object
    XML_address.ignoreWhite = true;
    // Add the handlers
    XML_address.onLoad = f_parseAddress;
    // Load the XML file
    XML_address.load("./Data/xml/kontakt.xml");
    This is my XML file
    <?xml version="1.0" encoding="iso-8859-1"?>
    <text>
    <address>
    <![CDATA[
    <font size="20">Company name</font>
    Company name
    address
    address
    Dir. tlf. + xx xx xx xx xx
    + xx xx xx xx xx
    Mobil + xx xx xx xx xx
    + xx xx xx xx xx
    web: <a href="
    http://www.xxxxxxxxxxxxx.xx"><b>www.xxxxxxxxxxxxx.xx</b></a>
    E-mail: <a
    href="mailto:[email protected]"><b>[email protected]</b></a>
    ]]>
    </address>
    </text>
    If anyone got a solution on how i can get my text to allign
    corect
    i would like to hear about it
    Best reguards
    Mis

    alrighty then try this xml structure.
    Note: formatting information like b, or linkage tags should
    not be part of the xml.
    The XML format is a universal format for data, if you fill it
    with style information this is not good practive (in general, there
    are of course scenarios where it makes sense, also since (x)html IS
    also XML).
    In your case you want to put the information about multiple
    companies in a xml file, but you let the flash decide how to
    display format this information.
    so if you use the sugested XMl structure you will have full
    control of the layout within flash, because you can grab every
    piece of information from the xml and place it jsut where you want
    in flash and format it within flash.
    Of course this process is more coding work than your previous
    attempt, but it pays of when you have a lot of data to process and
    when you want to have full control of the final layout.
    But maybe its overkill for your application (I don't know how
    many companies will be stored in your xml and how complex the rest
    of the app is).

  • Text Entry with Tab Key not advancing to next slide

    I am using Captivate 1 to create a screen that has a text
    entry requiring the user to press the Tab key as the Shortcut Key.
    The users are having to press the Tab key multiple times to get the
    course to advance to the next slide. There does not seem to be a
    rhyme or reason to which text entries this occurs in, nor does
    there seem to be a pattern to the number of times or forcefulness
    in which the Tab key must be pressed, though more aggressive key
    presses have yielded better results. Sadly, requesting the users
    bang the Tab key with as much force as they can muster is not a
    viable option.
    Here are things I have tried:
    Decrease length of slide
    Increasing active time of the text entry
    Adding/removing playback control
    Deleting and recreating text entries
    If anyone has any idea what can be done to correct this
    problem, it would be much appreciated.

    Hi berrylicious877
    The following has worked for me in Cap1, so try it and see:
    Add the text entry box and include the submit button.
    Make the submit button transparent and edit text to a full
    stop at the smallest available font size (Captivate won't accept a
    submit button without something typed in and a full stop is the
    smallest thing available display wise)
    On the submit button, set the shortcut key to "Tab".
    My reasoning was that the shortcut key on the text entry box
    "activates" the box, thus allowing input and the shortcut key on
    the "submit" button "deactivates" the box so that the slide can
    move on as required.
    Please let us know if this helps.
    Andrew

  • Firefox 3.6.11 does not respond on mouse, only Tab key and space bar

    HW: Lenovo R61i.
    OS: MS Win-XP PRO, ver 20002, SP3
    Internet Explorer is diabled in:
    Contol Panal|add/remove programs|add/remove windows components
    All other programs responds om USB mouse or the little joy-stick between G, H and B-keys.
    Removed FF, booted and reinstalled FF 3.6.11.
    Mouse works a couple of cliks - then Tab key and Space bar is the only tool.
    By the way - living in Norway, means No version og FF :)

    Getting very tired of this problem which is becoming much more frequent. I love the FF browser, but lately after I have been on line for a while, the browser stops responding to mouse clicks and I have to use the task manager to shut the program down and then reopen it to get it to work. From what I've been reading in the forums, this is not an uncommon problem. I've done all the recommended fixes and nothing works. Please fix this!!

  • AdvancedDatagrid Tab Key issue

    Hello, I have an advancedDatagrid which contains many editable column (InpuText) and each column has an itemrender. I see that the normal TAB key navigation behaivor disapear, can any one told me what's the best way to keep the Tab (shift+Tab) navigation behaivor between editable cells ? Thank you

    I am having a simular problem. The software I am training
    requires the user to use tab between fields. I changed the shortcut
    key on text entry boxes. Somewhere on this forum (I cannot find it
    now) I found a workaround that had me change the HTML file
    Between the writeDocument <object> </object>
    tags, add the following '<param name="SeamlessTabbing"
    value="false">'+
    when I publish without quiz reporting this worked fine. (it
    matches the html of the other lines in the writeDocument But when I
    publish with quiz reporting in AICC the HTML codes between the
    writeDocument is different.
    '<param name=quality value=high> \n'+
    I altered the code I show above to match the html written by
    captivate with no results. Any thoughts?

Maybe you are looking for

  • Best pratice on disabling fields?

    Hi,    I'm using jdev11R1. I'm having one jspx page named(firstpage.jspx). this page is on unboundedTF. I want to disable more than 15 fields on a single hit of button. but here each and every developer has different approach to do this. can any one

  • BW ignores selection criteria in a Infopackage after transport

    Hi all, After transporting Infopackages with selection criteria the target system ignores them. If I create further Infopackages on the target system everthing is fine. It seems as if the criteria were not transported but they are displayed. I replac

  • How can I sync my purchases to my iPhone from my new computer?

    Help please!!

  • Powerdvd 12 not working after update to windows 8.1

    My notebook came loaded with windows 8 and powerdvd 12 to drive the DVD drive.  After I accepted an update of windows 8 to 8.1, powerdvd 12 would no longer run.  I have restored the system back to factory setting and have been told that the Hp suppor

  • Error Message the ADF is jammed.

    Error Message the ADF is jammed. I don't see any paper or debree jammed anywhere and I already performed a cleaning of the rollers and feeder as outlined in HP. Anything else I am missing?