JTable row selection with tab key

Helo.
I'm having a problem selecting rows in a JTable. The JTable is with single row selection and without column and cell selection. When I press <tab> the selection changes to another cell, and I wanna it to change to the other row of the table, can anyone help me? I think this is a easy one and I haven�t found a way to do it. I�m using JBuilder for the development.

The default Action for the Tab KeyStroke is to move focus to the next cell.
The default Action for the Enter KeyStroke is to move focus to the next line.
So this functionality is already available in JTable by default.
If you want to Tab Key to work the same way as the Enter Key then you need to map the Tab Key to use the Action assigned to the Enter Key.
This [url http://forum.java.sun.com/thread.jsp?forum=57&thread=505866]posting shows how you can reassign an Action for a given KeyStroke.
For more information on this topic read this section from the Swing tutorial on [url http://java.sun.com/docs/books/tutorial/uiswing/misc/keybinding.html]How to Use Key Bindings.

Similar Messages

  • 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.

  • 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.

  • 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

  • ADF Faces 10g af:table row selection using SHIFT Key

    Hello,
    Is there a simple way in 10G af:table with multiple selection facet to enable selecting multiple rows of a table by selecting one row, holding the SHIFT key down, selecting another row way down, and having all the rows in the middle be automatically selected?
    So, this is essentially equivalent to "Select Range" Capability.
    Thank you for any information.

    I think the simple answer to your question is, no.
    In 11g, I think the answer is, yes; but you probably already knew that.
    You might consider altering the keySet associated with the table related to the multi-select checkbox facet. You could have some section above the table that selects these check boxes based on some entered filter criteria. The keySet is a little weird though. You might check out its usage in SRDemo Application Module Impl class code which deletes over this keyset, and work backwards from there.

  • JTable loses selection with custom renderes

    Hello,
    I have a JXTreeTable with five columns, out of which I have custom rendered 3 columns. When I select a node is the tree, the corresponding columns are selected except the custom rendered columns. Any reason why it would be so?.
    I have set the row selection enabled to be true.
    I know I shouldnt be posting JXTreeTable questions here, but am hoping any JTable guru's might be able to help me out
    Thanks
    K

    The general structure of the renderer code would be:
    class CustomRenderer extends DefaultTableCellRenderer
         public Component getTableCellRendererComponent(
              JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column)
              super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
              if (! isSelected)
                   // add your custom code here to change background
              return this;
    }

  • 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

  • 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.

  • Field validation with Tab Key

    I am writing an application in which I must validate the data a user enters into a textfield when the user presses the "Tab" key. I have added a KeyListener to the textfield and when this java code is run as an applet the KeyListener catches the Tab key and all works fine. When I run this as an application, the Tab key does not seem to be caught at all by the Key Listener.
    Has anybody else had this problem on the IPAQ, if so, do you know a solution.
    Any help would be GREATLY appreciated.

    I've been having this problem as well. I have created my applet using Visual Cafe 3 (Java 1.1). When I run this in Jeode it work great, Personal java works great, MSVM works great, but when I try to run using Sun Plugin 1.4.2_02 the tab key events are never fired.
    Does anybody have a solution for this? Unfortunately, we are stuck developing with an older version of Java because of Visual Cafe.

  • Switching accounts in email composition window with tab key?

    I recently switched from an iMac G5 to an Intel iMac. In the previous version of Mail, I was able to to switch between accounts when composing an email by tabbing to the "Accounts" field and using my up or down arrow keys. Now that I've switched to the Intel iMac, I've noticed that the tab key will move the cursor from the subject line, immediately down to the composition field, skipping the Accounts field completely. Is there some setting I've missed, or do I possibly have a corrupt version of Mail?

    Ok, I don't have an Intel Mac, but I don't think that is the issue. Open Keyboard and Mouse System Preferences and choose the keyboard tab. Select the Keyboard Shortcuts tab and select the option to Tab between all controls. Now you should be able to tab to the accounts pane. I think you may have had this set in the previous version, but it is now off.
    jim

  • A Listener For JTable Row Selection Changed?

    Never mind... Thought of a couple other things after I posted and found ListSelectionListener. This looks like it fulfills my requirement nicely. - cimmerian76
    >>>
    TableModelListener isn't what I am looking for here. Basically, I'm looking for something that behaves in a way that is analogous to
    TreeSelectionListener's valueChanged(...). Perhaps I'm looking in the wrong places, but the only things I've found were RowSet listener (not even close)
    and TableModelListener (not exactly what I'm looking for - I'm not concerned about data in the table changing).
    The tool I'm writing displays additional information about the object in the row selected in an adjacent panel.
    This display should change every time a user selects a different row.
    I can mimic the behavior I want using a mouse listener on the table, so this isn't an emergency.
    It's more about curiosity. If I can find something that produces this functionality directly, I would prefer to use that.
    <<<
    Message was edited by:
    cimmerian76

    Hi,
    you can use this to handle selection events for the table:
    yourTable.getSelectionModel().addListSelectionListener(... );
    Now e.g. the class containing your main can implement interface ListSelectionListener.

  • Toggling panels with tab key in lightroom

    my tab key in lightroom 3 is not toggling one panel at a time rather it simply hides all side panels at the same time.  What is happening?

    Hi chuquta,
    Here's the rundown of the panel shortcuts;
    Tab - hides the left and right panels
    Shift+Tab - hides left, right, and filmstrip
    F6 - toggles filmstrip
    F7 - toggles left panel
    F8 - toggles right panel
    Cheers, and hope this helps!

  • 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

  • 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

  • Controlling amount of space inserted with tab key

    Currently I get a style="margin-left: 40px;" added when I press the tab key.
    How can I change that amount to an additional 24px for each successive pressing of the tab key?

    Apfelwurm wrote:
    Yes, I understand that the photos take up a certain amount of space.
    We'll have to find out why.
    You could also sync your iPad without syncing any photos.
    Afterwards you can sync the photos again, but not before you have assured yourself that the photos do not take up an abnormal amount of space in the original directory on your Mac. And I mean the OS of your Mac, not 3rd party software.
    Does software written by Apple as part of the OS count as 3rd-party software?
    And I'm not sure why you are so focused on finding out the size of the individual files beyond what I've already stated.  iTunes and the iPad report 76 photos as taking up 3.96GB (or 3.95GB) of space.  None of those 76 files are that large.  This is after multiple soft and hard resets and multiple restores.
    I certainly don't own a camera capable of taking pictures where one photo takes up 53MB of space.  In addition, none of the 76 pictures come from a camera that I own.  They are all small files downloaded from websites that I have manually saved.  As I stated, the files range in size from 13.7KB to 1.2MB.  All small files.

Maybe you are looking for