How to recognize "tab" key?

hi all,
i wrote an editor using swings. To provide input through console, i used the event handlers for keyboard events like
keypressed(), key released()etc.. i also provided some tool bar for opening a file, saving etc. i was able to define the action for almost all the keys on the keyboard, except for some keys. i was unable to get the control of tab key. when i am pressing a tab key, the control is movig on toll bar options only. the conrol is not getting int the frame, on which i used to display the text.
what i finally require is that how can i get the control of 'tab key' and how can i define some actions that are to be performed on pressing tab keys.
i will be thankful if any body can help me in this regard.
bye one and all,

Try overiding the method isManagingFocus:
public boolean isManagingFocus() {
return true; //in order to catch TAB key
in your text area.
Netta

Similar Messages

  • How to supress tab key stopping at lables

    Hi everyone,
    after upgrading to 5.0 from 4.02 and changing the theme to 26 (productivity), there is now a problem with the tab key.
    Before, the tab key moved the entry scope simply to the next dialog field or list value; now the tab stops also at the labels.
    That means, to skip from one entry field to the next, you have to press tab twice.
    How can I change this back to the old way ?

    Norbert W. wrote:
    thank you for your response. I came from theme no.2 (Builder blue). I´ve tested this case with Firefox and Chrome (actual versions). The label templates are mostly "Optional with help", "Optional" and "Required with help".
    Now I found that "optional" is working as expected (without tabstop), while the others are producing stops.
    This is happening because the "with help" label templates contain links for displaying item-level help, and they therefore receive focus when using keyboard navigation. This is actually good accessibility practice, and you are recommended to retain it. Changing labels so they don't use "with help" templates where there is no help is also appropriate.
    The workaround used to avoid this standard behaviour in theme 2 is to include a tabindex attribute with a sequence number higher than the possible number of page items on the help links:
    <label for="#CURRENT_ITEM_NAME#" id="#LABEL_ID#" tabindex="999"><a class="optional-w-help" href="javascript:apex.theme.popupFieldHelp('#CURRENT_ITEM_ID#','&SESSION.')" tabindex="999">
    You could revert to this behaviour by editing the theme 26 "with help" label templates to include the tabindex:
    <label for="#CURRENT_ITEM_NAME#" id="#LABEL_ID#" class="uOptional"><a class="uHelpLink" href="javascript:apex.theme.popupFieldHelp('#CURRENT_ITEM_ID#','&SESSION.')" tabindex="999">

  • How to use tab key with JTextArea to shift focus

    Hi
    My problem is simple as whenevr i use tab key in my JTextArea, instaed of shifting focus to next component, it adds a tab space to my text.
    How do i shift focus out of my JTextArea.
    Ashish

    you can also redefine the textarea's TAB Key behaviour. The tutorial has a good example for that - better than i would be able to describe :-)
    look at http://java.sun.com/docs/books/tutorial/uiswing/misc/keybinding.html

  • How to use TAB key  rolling on the rank of a JTabbedPane ?

    I hope I can use TAB key to switch the different option item , how to do this ?
    Liwei

    You need to use a key listener. Something like:
            static class myKeyListener implements KeyListener
                    //KeyListener reuired methods
                    public void keyPressed(KeyEvent e)
                            int a = e.getKeyCode();
                            //Check if they pressed tab
                            if (a == e.VK_TAB)
                                   //Do whatever
                    public void keyReleased(KeyEvent e)
                    public void keyTyped(KeyEvent e)
            }Then, put "myTabbedPane.add(myInstanceOfMyKeyListener" up where you're creating the pane, replacing "myTabbedPane" and "myInstanceOfMyKeyListener" with whatever variables you're using.

  • How to draw tab key char into Graphics g as space?

    Hi, all.
    following pg.drawString(token, 0, y); keep draw "\t" strange character like "o".
    eg: "\tpublic static"--after draw..--> opublic static".
    As you see below, I replace "\t" with " "(blankes).
    I test replaceString method. it works fine.
    but, once it draw it, it keep draw "o" string where the "\t" was.
    What's problem?
    //called for print.
    public int print(Graphics pg, PageFormat pageFormat,
              int pageIndex) throws PrinterException {
    //some code...
    String tabReplace=" ";
    StringTokenizer parser = new StringTokenizer(contents, "\n");
         try {
         while(parser.hasMoreTokens()) {
              String token=replaceString(parser.nextToken(), "\t", tabReplace);
              pg.drawString(token, 0, y);
              y+=fm.getHeight();
              y+=lineSpace;//lineSpace comes from use option               
         } catch (NoSuchElementException e) {
         System.out.println(e);
    //some code..
         public String replaceString(String contents, String replace,
                                                 String with){
              int indexHead=0, indexTail=0;
              while(( indexTail = contents.indexOf(replace, indexHead) ) >0){
                   contents=contents.substring(indexHead, indexTail)+
                             with+contents.substring(indexTail+replace.length());
                   indexHead+=with.length();
              return contents;
    f

    Any unprintable character draws the square 'o' on a graphics object, not only \t. Since your code is correct, it will replace away all \t in the string, means there are no \t left in the string. Since there is still unprintable character resident in the string, you need to check that the string that you draw is the correct one or which character that is unprintable. How about looping through the string and print the char-as-int to system int. Look for fairly low numbers < 32 and 127 as they would not be printable by normal means.
    Regards,
    Peter Norell

  • ItemFocusOut not catching  "TAB" key in Datagrid edited cell?

    In DataGrid, "keyUp" can catch "TAB" key when it is pressed,
    but the Keyboard event has less information needed. I tried
    itemFocusOut, but it seems DataGridEvent would not catch it. Any
    tips on how to make "TAB" key generate DataGridEvent or similar
    event?
    Platforms with this issue: WIN-XP/JDK-1.6/Air-1.5/FLEX
    SDK-3.2
    Thanks!
    -Herbert

    Let me rephrase like this:
    In our application, a DataGrid’s edited cell has
    “itemEditEnd” and “itemEditBeginning”
    handlers defined. However when a “TAB” key is pressed
    to navigate from one editable cell to another editable cell, none
    of the above handlers can catch this special key stroke event.
    Our intention is to make “TAB” key to emit an
    event that can be caught by above handlers. Or, in other words, we
    would like make “TAB” key to be similar(in the sense of
    generating events) to that of “Enter” key when pressed.

  • Override "crtl + tab" key behaviour with "tab" key for JtextArea .

    I am trying to override the "crtl + tab" key behaviour for JTextArea with "tab" key plus add my own action. I am doing the following.
    1. Setting Tab as forward traversal key for the JTextArea (the default traversal key from JTexArea is "crtl + Tab").
    2. Supplementing the "crtl + Tab" key behaviour with my custom behaviour.
    For the point 2 above, I need to get hold of the Action represented by the "crtl + Tab" key so that I could use that and then follow with my own custom action. But the problem is that there is no InputMap entry for "crtl + tab". I dont know how the "crtl + tab" key Action is mapped for JTextArea. I used the following code to search the InputMap.
                System.out.println("Searching Input Map");
                for (int i = 0; i < 3; i++) {
                    InputMap iMap = comp.getInputMap(i);
                    if (iMap != null) {
                        KeyStroke [] ks = iMap.allKeys();
                        if (ks  != null) {
                            for (int j = 0;j < ks.length ;j++) {
                                System.out.println("Key Stroke: " + ks[j]);
                System.out.println("Searching Parent Input Map");
                for (int i = 0; i < 3; i++) {
                    InputMap iMap = comp.getInputMap(i).getParent();
                    if (iMap != null) {
                        KeyStroke [] ks = iMap.allKeys();
                        if (ks  != null) {
                            for (int j = 0;j < ks.length ;j++) {
                                System.out.println("Key Stroke: " + ks[j]);
                }In short, I need to get the Action associated with the "crtl + tab" for JTextArea.
    regards,
    nirvan.

    There is no Action for Ctrl+TAB. Its a focus traversal key.

  • How to recognize the tab key in a JTextField

    I have a drawing program with a main window and a tools palette, which is a JDialog. The tools palette has JToggleButtons and one JTextField. When you have the focus in the JTextField and you press tab repeatedly, it tabs through all the JToggleButtons and then back into the JTextField.
    However I would like to recognize the pressing of the tab key and ask for the focus to go back to the main window.
    I subclassed the JTextField, added a KeyAdapter, but it does not recognize the tab key. I also added the processKeyBinding method, but it doesn't recognize the tab key either.
    How can I recognize the tab key?
    Here is a self-contained test program that illustrates the problem:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class AnanyaCurves extends JFrame
      Tools tools;
      public AnanyaCurves(Dimension windowSize)
        Basics.ananyaCurves = this;
        enableEvents(AWTEvent.WINDOW_EVENT_MASK);
        setTitle("Ananya Curves");
        tools = new Tools(this);
      public static void main(String[] args)
        int toolsWidth;
        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        toolsWidth = 200;
        Dimension windowSize = new Dimension(screenSize.width - toolsWidth, screenSize.height - 58);
        AnanyaCurves ananyaCurves = new AnanyaCurves(windowSize);
        ananyaCurves.pack();
        ananyaCurves.setBounds(toolsWidth, 0, windowSize.width, windowSize.height);
        ananyaCurves.setVisible(true);
        ananyaCurves.requestFocus();
      public void setVisible(boolean b)
        tools.setVisible(b);
        super.setVisible(b);
    class Basics extends java.lang.Object
      public static AnanyaCurves ananyaCurves;
      public Basics()
    class Tools extends JDialog
      JToggleButton btnGrid;
      JTextField textGrid;
      JPanel panel;
      public Tools(JFrame frame)
        super(frame, "Tools", false);
        enableEvents(AWTEvent.WINDOW_EVENT_MASK);
        btnGrid = makeBtn("Grid");
        textGrid = makeTextField();
        panel = makePanel();
        pack();
      public JToggleButton makeBtn(String name)
        JToggleButton btn = new JToggleButton();
        btn.setMaximumSize(new Dimension(108, 24));
        btn.setPreferredSize(new Dimension(108, 24));
        btn.setText(name);
        btn.setFont(new Font("Verdana", Font.PLAIN, 11));
        btn.setMargin(new Insets(5, 10, 5, 10));
        btn.setOpaque(true);
        return btn;
      public ACJTextField makeTextField()
        ACJTextField textField = new ACJTextField();
        textField.setFont(new Font("Verdana", Font.PLAIN, 12));
        textField.setMaximumSize(new Dimension(108, 20));
        textField.setPreferredSize(new Dimension(108, 20));
        textField.setText("0.25");
        textField.setEnabled(true);
        return textField;
      public JPanel makePanel()
        JPanel panel = new JPanel();
        panel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
        panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
        panel.add(btnGrid);
        panel.add(textGrid);
        getContentPane().add(panel);
        return panel;
    class ACJTextField extends JTextField
      KeyAdaption keyAdaption;
      public ACJTextField()
        super();
        keyAdaption = new KeyAdaption();
        this.addKeyListener(keyAdaption);
      class KeyAdaption extends KeyAdapter
        public void keyPressed(KeyEvent event)
          int keyCode = event.getKeyCode();
          if (keyCode == KeyEvent.VK_TAB)
            Basics.ananyaCurves.requestFocus();
      protected boolean processKeyBinding(KeyStroke keyStroke, KeyEvent keyEvent, int int2, boolean boolean3)
        int keyCode = keyEvent.getKeyCode();
        if (keyCode == KeyEvent.VK_TAB)
          Basics.ananyaCurves.requestFocus();
          return false;
        return super.processKeyBinding(keyStroke, keyEvent, int2, boolean3);
    }Thanks for looking at this.

    Wow, Michael, you work like magic! Thanks so much! I would be happy to give you a commercial key to my Ananya Curves program also once the second release is on my website. It's a program for drawing curves in an easier way without pulling on tangent lines, with all control points right on the curve. Just send me an email to [email protected] if you are interested!

  • How do I use a Tab key to maximize a frame?

    How can I use a Tab key (vk_tab) pressed on the focused frame to actually maximize the frame... what action should it have attached to it?
    thanks!

    tab is the focus traversal key, so will be consumed before getting to your listener
    try this instead
        KeyboardFocusManager.getCurrentKeyboardFocusManager()
         .addKeyEventDispatcher(new KeyEventDispatcher(){
            public boolean dispatchKeyEvent(KeyEvent e){
              if(e.getID() == KeyEvent.KEY_PRESSED)
                if(e.getKeyCode() == KeyEvent.VK_TAB ) f.setExtendedState(JFrame.MAXIMIZED_BOTH);
              return false;
        });

  • How to determine the positioning order when using tab key?

    Hallo,
    in my jspx-page i want to define the order which the cursor jumps when the user is using the tab key.
    i don't know how to? in html there i can use tabindex. which way i must go?
    Any help is appreciated.

    I found that tabindex is not applicable. But i think it is an important point for better handling.
    Is there no easy way to do it?

  • How do you navigate dialogue boxes using the tab key in Photoshop CS6 on Mac OS X Mavericks?

    I know that seems really 101 and obvious, but I worked in Photoshop on a PC for many years, and using the tab key to navigate through every field/radial button/dropdown menu/etc. was never an issue. On the Mac OS X however, it only navigates through certain fields within a dialogue box. And before the guaranteed suggestion to change my Mac OS X Keyboard preferences to allow full keyboard access to "All Controls" instead of "Text Boxes and Lists Only", I have already tried this setting which did not resolve my issue.
    Does/has anyone out there worked between both platforms and had this issue as well? I'm a Mac guy through and through, but I must say, this is the one thing that I think PC has a slight edge on. It's incredibly frustrating to have my keyboard workflow interrupted because I can't simply tab over to a certain field that is in a dialogue box which I'm currently working in...
    Here are my details:
    Photoshop CS6 (13.0.6)
    Mac OS X Mavericks (10.9.1)
    Applies to all filetypes as the issue is regarding dialogue boxes and not files themselves.
    No error message.
    Normal use.
    It works on PC, but not on Mac.
    2.3 GHz Intel Core i7 Processor
    8 GB of memory
    719 GB of space available on my main HD
    This has never worked in any version of Photoshop I have used on any version of Mac OS X, but has worked consistently on every version of Photoshop that I have used on every version of Windows I've used (up to Windows 7)
    I hope this provides enough information to get the ball rolling on this. I fear that there is no answer that will resolve the issue, but before I throw in the towel, I figured it was worth trying this forum since my web searches have turned up absolutely nothing of help.
    Thanks in advance for your time and help.
    Best,
    Tim

    Thanks for your input.  Since Safe Mac's Adware Removal tool has done a very good job of cleaning out the junk and
    letting me run better, I'm happy for now.
    However, I appreciate your judgement and I am working on evaluating Safari vs FireFox vs Chrome.  I've had some trouble using FireFox with
    LastPass which works very well under Chrome.  But that is only one data point.  Most of my Ram troub;e os related to the number of windows
    and tabs I open.  I've tried comparing the three browsers for how back each reacts.
    I multiply windows and tabs because as I surf the web, I discover things I want and don't want to lose them.  However, I need a tool more useful
    and structured than bookmarks to be able to record things of interest to make them easy to return to and find later.

  • How to show list of items when the user pressed tab key in an empty field

    Hi all
    i would like to know if there is a way to open a form with items list which will be shown to the user when he pressed the tab key within a field for instance "item code" field will present a search form with a table filled with item codes and their description.
    i'm currently working in 2004 version. i know how to catch the event.
    i'm creating a form with a matrix object binded to a datasource which is connected to the data base table which contains all the items.
    what would like to know if there is a better way to this. maybe using buisness partner objects. and if so how
    appriciate the help
    Yoav

    You Should use Formatted Search in this case.
    You must create and associate a query for your field.
    click on the field you want items to be listed and press Shift + F2
    catch the keydown event of this field  and check pval.charpressed = 9 (tab key press)
    then execute
    SBO_Application.SendKeys("+")

  • How can I get the tab key to select text fields only?

    Since upgrading to Firefox 4 on Windows, the tab key functions differently. How do I change it so that it only selects text input fields?

    The answer is:  The bug is in the UI.  Speech recognition was enabled, by default it uses the bare escape key as a "mic on" indicator, and it does not leave any trace in the keybord configuration.  So that is the bug.  It needs to leave a trace there, a la: "X Listen-for-voice-command  ^" under Mission Control.

  • How to set current row in table after use tab key on inputText

    Hello all,
    My first post .., I'm newbie in ADF and I will try to explain my problem.
    For the moment we use ADF 11g (11.1.1.4), in a jsff page I have a table with an inputText column.
    On the valueChangeListener of the inputText, I invoke a method in a viewScope bean which call an EJB method, make some services in the EJB on the line modified. After that I refresh the VO and the table (because others values on the line have been modified) and reset the focus on the same inputText modified by the user with javaScript because focus was lost after refresh.
    So far, everything works fine.
    When I use the arrow keys to change the selected row in the table, it's work fine (focus is still in the next or previous inputText), but if user try to use tab key to change the current line, the inputText on the next line have the focus but the current row of the table is not changed (I think it's normal).
    My question : how can I change the current row after tab key pressed in this case ?
    I don't know if it's really clear, not easy to explain, don't hesitate to ask more details.
    Thanks in advance.

    Frank Nimphius wrote:
    Hi,
    My question : how can I change the current row after tab key pressed in this case ?
    Use a client event to listen for the keyboard entry and intercept the tab. The use af:serverListener to call the server to set the rowKey on the table and issue a PPR for the table to re-paint
    See sample 11 on http://www.oracle.com/technetwork/developer-tools/adf/learnmore/index-101235.html#CodeCornerSamples
    to learn about how to use the client listener and server listener
    FrankHi,
    Thanks a lot for your advices, I used the client and server listener
    I used this code on the method call in order to change the selection after key tab pressed, I don't know if it can be easier, but it works.
              if (LOGGER.isDebugEnabled()) {
              LOGGER.debug("START changeSelectedRow");
              RowKeySet oldRowKeySet = myTable.getSelectedRowKeys(); // get oldRowKeySet
              if (oldRowKeySet == null) {
                   if (LOGGER.isDebugEnabled()) {
                        LOGGER.debug("oldRowKeySet is null");
                   return;
              RowKeySetImpl newRowKeySet = new RowKeySetImpl(); // The new RowKeySet use to change the selectedRow
              DCIteratorBinding bindingIterator = ADFUtils.findIterator(MY_ITERATOR);
              bindingIterator.setRangeSize(-1);
              // set the new index of the current row.
              int index = bindingIterator.getCurrentRowIndexInRange();
              if (index < bindingIterator.getAllRowsInRange().length - 1) {
                   index++;
              bindingIterator.setCurrentRowIndexInRange(index);
              // get the current row after changed the index
              Row currentRow = bindingIterator.getCurrentRow();
              if (currentRow != null) {
                   ArrayList nextLst = new ArrayList(1);
                   nextLst.add(currentRow.getKey());
                   newRowKeySet.add(nextLst);
                   // set the new selectedRow
                   myTable.setSelectedRowKeys(newRowKeySet);
                   SelectionEvent selectionEvent = new SelectionEvent(oldRowKeySet, newRowKeySet, myTable);
                   selectionEvent.queue();
                   AdfFacesContext.getCurrentInstance().addPartialTarget(myTable);
              if (LOGGER.isDebugEnabled()) {
                   LOGGER.debug("END changeSelectedRow");
    Best Regards
    Benjamin

  • How do I get my caps lock and tab keys to work again?

    how do I get my caps lock and tab keys to work again?

    Have a look at > One or more keys on the keyboard do not respond

Maybe you are looking for

  • SAP SSO between Microsoft AD and SAP R/3 GUI&WebGui

    Hello Everybody, We are looking in to implementing SSO between Mircosoft AD and our SAP CRM ABAP 7.0. We have users both logging in through SAP Gui and also the web gui. Found there a multiple options for achieving SSO: 1) SNC 2) X.509 cerfificate 3)

  • Error in OBIEE report

    Hi Gurus, I have a summary report and detailed report and a currency prompt in my dashboard. The summary report has to be displayed only if one currency is selected by the user. For this, I am using a condition in section and in the report I am using

  • Getting "this site untrusted...". tried the fixesn help pages, but still receiving the error messages. Also some pages are not showing correctly, no graphics

    Started receiving "This site untrusted...."messages on sites I open all the time in Mozilla. I have tried the fixes in the help section but problems continue. Also, some sites like facebook don't appear correctly, just text and no regular graphics et

  • Need to cancel my Adobe PDF Pack subscription

    I just need to cancel my Adobe PDF Pack subscription, as I already bought Adobe Acrobat Pro IX. I have been on chat and on the phone with Customer Support for a couple of times, hours at a time. No response.  I am ready to call my credit card to disp

  • An error occured downloading ios 7.0

    I went to go Download the update and i Keep getting an error occured downloading ios 7.0 This is some Bul **** may i Add and my buddies phone doesnt even show the update yet what is going on Such a Sweet up Date turning in to a pile of ****.