Why can I not tab out of table cell after running command from keyboard

In my Jtable I have context menu with actions that can be performed on the selected cells either using mouse, or the action can be initiated directly from the keyboard using the defined acceleratorkey.
After the action has completed you can tab out of the selected cells using the Tab key or cursor keys if the action was initiated with the mouse, but not if initiated with the keyboard but Im at a loss as to what causes the difference.
thanks Paul

I found this one someWhere, maybe check your code if Cell returns true = isCellEditable(row, column)
import java.awt.event.*;
import javax.swing.*;
public class TableActions extends JFrame {
    private static final long serialVersionUID = 1L;
    public TableActions() {
        JTable table = new JTable(15, 5) {
            private static final long serialVersionUID = 1L;
            @Override
            public boolean isCellEditable(int row, int column) {
                return column % 2 == 0;
//              return false;
        table.setPreferredScrollableViewportSize(table.getPreferredSize());
        JScrollPane scrollPane = new JScrollPane(table);
        getContentPane().add(scrollPane);
        InputMap im = table.getInputMap(JTable.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
        //  Have the enter key work the same as the tab key
        KeyStroke tab = KeyStroke.getKeyStroke(KeyEvent.VK_TAB, 0);
        KeyStroke enter = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0);
        im.put(enter, im.get(tab));
        //  Disable the right arrow key
        KeyStroke right = KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, 0);
        im.put(right, "none");
        //  Override the default tab behaviour
        //  Tab to the next editable cell. When no editable cells goto next cell.
        final Action oldTabAction = table.getActionMap().get(im.get(tab));
        Action tabAction = new AbstractAction() {
            private static final long serialVersionUID = 1L;
            @Override
            public void actionPerformed(ActionEvent e) {
                oldTabAction.actionPerformed(e);
                JTable table = (JTable) e.getSource();
                int rowCount = table.getRowCount();
                int columnCount = table.getColumnCount();
                int row = table.getSelectedRow();
                int column = table.getSelectedColumn();
                while (!table.isCellEditable(row, column)) {
                    column += 1;
                    if (column == columnCount) {
                        column = 0;
                        row += 1;
                    if (row == rowCount) {
                        row = 0;
                    if (row == table.getSelectedRow()//  Back to where we started, get out.
                            && column == table.getSelectedColumn()) {
                        break;
                table.changeSelection(row, column, false, false);
        table.getActionMap().put(im.get(tab), tabAction);
    public static void main(String[] args) {
        TableActions frame = new TableActions();
        frame.setDefaultCloseOperation(EXIT_ON_CLOSE);
        frame.pack();
        frame.setLocationRelativeTo(null);
        frame.setVisible(true);
}

Similar Messages

  • Why can I not FaceTime out of province numbers on my new iPad mini that I can on my iPhone?

    Why can I not FaceTime out of province numbers on my new iPad mini that I can on my iPhone?

    Hello anthonyfromkeewatin,
    Thanks for the question. After reviewing your post, it sounds like FaceTime works but not to certain numbers. I would recommend that you read this article, it may be able to help you isolate or resolve the issue.
    iOS: Troubleshooting FaceTime - Apple Support
    Thanks for using Apple Support Communities.
    Have a nice day,
    Mario

  • Why can i not call out when in roaming but can recieve calls

    why can i not call out when roaming and my data shuts off but i can recieve calls

        rhondahuffman1,
    These are great question and we definitely want to help out! For starters, what model of device are we working with? Are you roaming outside of the country or is the device stating roaming within certain areas? What's your zip code? Happening in specific locations? Share some details, so that we may assist.
    AdamG_VZW
    Follow us on Twitter @VZWSupport

  • Why can i not log out of facebook

    why can i not log out of facebookand everytime i go on the facebook websit it just restarts  and when i check my emails from my i phone i go on a website called badoo it does not let me read it any more i could read them before

    That's just how it is. I've had Game Center logging me back into games since iOS6.  The closest I can come to anonimity on Game Center is to either not use Game Center games or create a generic ID for use in Game Center only.

  • Why can I not open raw images in bridge after down loading raw plug-in for my new Canon 70D?

    Why can I not open raw images in bridge after down loading raw plug-in for my new Canon 70D dozens of times?  I have never had any where near this amout of trouble with all my other Canon digital cameras. 
    <Removed by Moderator>

    http://helpx.adobe.com/creative-suite/kb/camera-raw-plug-supported-cameras.html
    http://helpx.adobe.com/x-productkb/global/camera-raw-compatible-applications.html
    Mylenium

  • Why can I not log into The app store after changing credit card information?

    Why can I not log into the App store after changing credit card information?

    DNS -
    Some folks resolve download and other connection issues by using either OpenDNS or Google Public DNS services. The best use is to use it as the DNS configuration in your modem/router/gateway device, but often the configuration in the computer or iOS device will over ride the other configuration if you don't have access.
    Open DNS;
    http://www.opendns.com
    208.67.222.222, 208.67.220.220
    Google Public DNS;
    https://developers.google.com/speed/public-dns/
    8.8.8.8, 8.8.4.4

  • Why can I not adjust the volume on a video when accessed from the lock screen

    Why can I not adjust the volume of a video in my pictures folder, when accessed from the new lock screen option?

    There is no way to access videos directly from the lock screen.
    What exactly is being attempted here?

  • HT201303 How can we delete our credit card details and also why can we not download free apps or by apps with credit from an i store card that has been redeemed????

    How can I delete credit cards details from my iPad Air and why cant I use credit from a i store card that has been redeeme?

    To remove the card's details from your iTunes account, tap on your id in Settings > iTunes & App Store and then tap on 'View Apple ID' on the popup and log into your account  - on your account's page there should be a payments link. Or you can do it via your computer's iTunes : go into the Store > View Account menu option and log into your account, and on your account's details click on the payment details link.
    Changing payment info : Change or remove your payment information from your iTunes Store account (Apple ID) - Apple Support
    If you don't get the 'none' option on the payment details screen : Why can’t I select None when I edit my Apple ID payment information? - Apple Support
    What happens when you try to buy something ? If you are trying to gift content then you will need to have a credit card on your account, your balance can't be used for gifting ; if you are trying to buy for yourself and you have a credit card on your account then its details need to be correct and complete - but your balance should be charged for the purchase.

  • Why can I not print out a pdf-file (train ticket NS) when downloaded with Firefox? (file says (SECURED)

    When ordering and paying a train ticket by internet they send a pdf-file, which one must download and print. When downloading this with Firefox (from my e-mail account) the pdf-file says (SECURED) and I cannot print out the ticket (pdf-file). (Adobe program stops automatically).
    When downloading this same pdf-file in Safari, I encounter no problems.

    Current Firefox versions have enabled a built-in PDF Viewer that doesn't have all features that other PDF readers like the Adobe Reader have or may not function properly otherwise.
    You can change the action for Portable Document Format (PDF) from Preview in Firefox to use the Adobe Reader application or set to "Always Ask" in "Firefox > Preferences > Applications".
    *https://support.mozilla.org/kb/change-firefox-behavior-when-open-file
    See also:
    *https://support.mozilla.org/kb/view-pdf-files-firefox-without-downloading-them

  • Why can I not log out of Game Center

    Since yesterday I am not able to log out of game canter.
    I know how it is supposed to work, and did work until yesterday. Every time I tap on the sign out option, it automatically signs me back in.
    I did a device reset, to no avail. Any suggestions?

    That's just how it is. I've had Game Center logging me back into games since iOS6.  The closest I can come to anonimity on Game Center is to either not use Game Center games or create a generic ID for use in Game Center only.

  • When using Adobe Colour in Photoshop, Why can I not pick out colours from an image open and first up in Photoshop?

    Am I doing something wrong?  Seems like it should be a no brainer, click for the color dropper and pick up a color.. seems I'm the one with the no brain thought because for the life of me it will not work. Then I would always go to colour Lovers and just upload my image and take the readings and put my theme together there.

    This Forum is dedicated to Photoshop.
    You may want to look for a more specific Forum.
    Adobe Color

  • Why can I not see previews of DNG imports in LR 5 from Pentax K3 (DNG) files.

    Same files preview in LR3 without problem. MAC OS X 10.7.5 LR 5.3 CR 8.3
    LR 3
    LR 5 - Am I missing a preference setting?

    I have a similar problem. I found out that my macbook air created a new USER with my former's computer user name. You can check that by going into System Preferences -> User & Groups, and see if a "Other user" has been created. You have to login under this new USER to find your transferred contacts in the address book.
    My problem is that I do not know how to merge the 2 USER logins or transfer the data from the new USER created into the existing one.

  • HT1491 Why can I not hear the sound on a video I downloaded from iTunes on my ipad

    I downloaded the new episode of Sons Of Anarchy and I can't hear it. It looks fine though. I bought the season pass and was able to watch and hear the other episodes.

    There is no way to access videos directly from the lock screen.
    What exactly is being attempted here?

  • Why can I not save apn settings on iPad after ios7 upgrade?

    After upgrading my iPad2 to ios7, I am unable to save apn settings.

    I still have the problem with one service provider, to fix it I use SIM  from another internet provider which sim is recognized by my ipad, then I  set APN for the first provider and reinsert again the first sim, and  works fine.
    Ocassionaly I have to do this proccess again when it is misconfigured or after new ios upgrade.
    I have IOS 7.04 version
    Try another SIM from different carrier
    Hope this can help you

  • Why can i not read my yahoo email?

    why can i not read my yahoo email? after downloading fire fox 8.01 i can not read my e Mail in yahoo any more and some of my buttons do not work this has been going on for about two to three weeks. i am thinking about going back to fire fox 3.6 where i had every thing working right. you change things to often without working out all of the bugs. and add 10x more bugs. Stan

    Open up Font Book (located in the Applications folder) and look for Helvetica Fractions. If you find it, delete it. Restart Safari and let us know what happens.

Maybe you are looking for

  • Mp3s in Library will not transfer to iPod

    Yesterday I used Real Player plus Audio Hijack pro to download a series of BBC comedy programs (from BBC7). The MP3 files were stored on my desktop. I double clicked each one and iTunes (v 5.01) opened and imported them into the library. I dragged th

  • V3 RAZR used to sync in 10.3.9, now won't sync under 10.4.6 (iSync 2.2)

    My Cingular V3 RAZR paired and synch'd (address book and iCal events) under 10.3.9 without issue. Recently did clean install of Tiger, using Setup Assistant to transfer personal files from a FW clone. Now under 10.4.6 (iSync 2.2), iSync WILL NOT reco

  • Price match on iPhone 5C

    Looking into getting a new phone. The iPhone 5C is on sale for $27 at Sam's Club. Will BestBuy price match this?

  • Idml from CS5 cannot be open on same machine

    A idml from CS5 cannot be opened on the machine where it was made neither on CS4 nor on CS5. „The file xxx.idml can not be opened. The file format is not supported by AdobeInDesign, a lack of support necessary add-on module or the file is already ope

  • PO creation BAPI

    Dear Gurus, I am trying to create an account assignment - "K" - PO through BAPI_PO_CREATE. The condition is that the net price should get updated only from the info-record. But, eventhough we are passing the net price into the BAPI from the input fil