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 3272232
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T18:48:18+00:00 2026-05-17T18:48:18+00:00

You can go into a cell in a Jtable either by clicking on it,

  • 0

You can go into a cell in a Jtable either by clicking on it, or by going into it using cursor keys/tabs. With defaultCellEditor and a JtextField if you go in using cursor keys the caret is put at the end of the existing text field, whereas if you double click the field it will highlight the last word.

Whereas spreadsheets seem to work (such as Open Office Calc) the same way for a double clcking, but if you tab into the field and start editing the field is cleared and the first character pressed becomes the first value in the field and so on.

I want my app to work the same way as the spreadsheet. By subclassing DefaultCellEditor and adding

final Caret caret = editField.getCaret();
    caret.setDot(0);
    editField.setText("");

I can get it to work how I want when tabbing but it also clears the field on double click which I dont want.

So please how can I determine if cell editing has been triggered by keyboard or mouse ?

  • 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-17T18:48:18+00:00Added an answer on May 17, 2026 at 6:48 pm

    override the isCellEditable(EventObject anEvent) method too.

    So that you can capture the event which is going to trigger (or not) the table edition and act the way you want

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to put individual JComboBoxes into each cells of a JTable. ie. The
VB6 IDE can get into a state when the Make XXXX menu option under
I have binary data in a file that I can read into a byte
How do I limit the types of HTML that a user can input into
Is '' a valid piece of XML? Can '' insert into oracle xblob column
I have several somewhat separate programs, that conceptually can fit into a single project.
I have a sql database that stores some documents. A user can sign into
I need to convert → (&rarr) to a symbol I can type into a
Can anyone point into the right direction here. I want to respond when my
I like how SQLite library can be included into an application and the application

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.