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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T05:04:44+00:00 2026-05-20T05:04:44+00:00

I have a JTable with 3 column of which first column is a button

  • 0

I have a JTable with 3 column of which first column is a button and second column is id. Now when user clicks on the button of specific row that row should be deleted. Up to this point everything wo$rks fine. But another requirement is re-sequencing the table data. I mean the column id should be re-sequence. For example:

First table data:

   | id | another-column
b1 | 1  | abc
b2 | 2  | xyz
b3 | 3  | def
b4 | 4  | qwe

Now when user deletes second row which have id=2 then table data should be as follows:

   | id | another-column
b1 | 1  | abc
b3 | 2  | def
b4 | 3  | qwe

Here b1/b2/b3/b4 are buttons for deletion of particular row.

How can I do this?

  • 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-20T05:04:45+00:00Added an answer on May 20, 2026 at 5:04 am

    It is fairly easy to set this sequential id value inside the getValueAt(row, col) of your Abstract Table Model.

    public Object getValueAt(int row, int col) {
       if (col == 1) 
          return int (row + 1);
          .....
    }
    

    Set the model again inside the action event of your buttons. The model will repaint the JTable correctly after a button has been pressed.

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

Sidebar

Related Questions

I have a JTable where the first column in each row is a checkbox.
I have a JTable which has 1st row blank. Now when I sort the
I have a JTable . I want to know which row and column are
Hi I an issue with editors in a JTable. I have a column which
I have a JTable which has certain cells editable. If the user enters in
I have a Jtable with a checkbox in first column. I want to strikethrough
I have a JTable that will have the last column data field change to
I have a Jtable on which I called the method table1.setAutoCreateRowSorter(true); . So this
I have a JTable which is bound to my EventTracker bean, essentially a wrapper
I have created a JTable, the table contains 4 rows, and for a specific

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.