Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6677305
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:06:08+00:00 2026-05-26T04:06:08+00:00

The default behaviour in a JTable seems to be that if I reach the

  • 0

The default behaviour in a JTable seems to be that if I reach the last row of a column and hit return, I am taken to the first row of the next column. Is there a way to avoid this? Please suggest a way that I could stay at the last row of the same column. I also want to avoid a situation where I am taken to the next column and then detect that and go back to the previous one, because I have some listeners associated with it.
Any help is appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T04:06:09+00:00Added an answer on May 26, 2026 at 4:06 am

    to change any of the navigational behaviour, replace the default navigational actions with your own. Best by wrapping the defaults: conditionally either do the default or your custom stuff. Something like

        Object key = table.getInputMap(JTable.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT)
            .get(KeyStroke.getKeyStroke("ENTER"));
        final Action action = table.getActionMap().get(key);
        Action custom = new AbstractAction("wrap") {
    
            @Override
            public void actionPerformed(ActionEvent e) {
                int row = table.getSelectionModel().getLeadSelectionIndex();
                if (row == table.getRowCount() - 1) {
                    // do custom stuff
                    // return if default shouldn't happen or call default after
                    return;
                }
                action.actionPerformed(e);
            }
    
        };
        table.getActionMap().put(key, custom);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Auto-binding of request params seems like default behaviour, but I can't find a lot
How to change default emacs mark-paragraph function behaviour to not select first empty line?
I'm currently trying to change the default behaviour of a multiselect element, so that
I've noticed that the default behaviour for a DataGrid's vertical scroll bar is to
The default behaviour of a WPF DataGrid is to select when a row is
According to docs numpy's default behaviour is to index arrays first by rows then
..with the KeyColumn method or change the default behaviour with a Convention. That quote
I want to change this default behaviour. I know that this could be done
I'm trying to add a CSS rule that makes the default behaviour to not
In Windows Forms the default behaviour of a TabControl is to have the tabs

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.