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

  • SEARCH
  • Home
  • 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 8799183
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T00:15:31+00:00 2026-06-14T00:15:31+00:00

See my method public void removeRow(int[] selectedRow) { int len = selectedRow.length; for(int i=0;

  • 0

See my method

public void removeRow(int[] selectedRow) {
    int len = selectedRow.length;
    for(int i=0; i<len; i++) {
        data.remove(selectedRow[i]);
    }
    fireTableDataChanged();
}

this is the error callstack

Exception in thread “AWT-EventQueue-0” java.lang.IndexOutOfBoundsException: Index: 1, Size: 1
at java.util.ArrayList.RangeCheck(ArrayList.java:547)
at java.util.ArrayList.remove(ArrayList.java:387)
at table.MyTableModel.removeRow(MyTableModel.java:89)
at table.Tables$2.actionPerformed(Tables.java:61)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)

I am using static ArrayList data as data holder

  • 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-06-14T00:15:32+00:00Added an answer on June 14, 2026 at 12:15 am

    The problem is that when you remove a row, your tables indices are adjusted/decremented on each remove resulting in the IndexOutOfBoundsException. You could remove the rows in reverse order to guard against this:

    for (int i = selectedRow.length - 1; i >= 0; i--) {
       data.removeRow(selectedRow[i]);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

this is my getView method: public View getView(final int position, View convertView, final ViewGroup
I have this method: public void onClick(View v) { if (test != true) {
Please see following methods. public static ProductsCollection GetDummyData(int? customerId, int? supplierId) { try {
This simple Python method I put together just checks to see if Tomcat is
I have the below method: public void Enqueue(ICommand itemToQueue) { if (itemToQueue == null)
I'm calling this method: public Set<RequestVO> getRequestBySupplier(SupplierVO objectVO) I have a OrderController with this
Here is my method: public void addEmployee(Employee employee) { if(! employees.containsKey(employee.getName())) { employees.put(employee.getName(), employee);
I fail to see the reason why this code fails (Error binding to target
Lets say I have an interface passed to my method: public void AlphaToChar(iList _blah)
The example I see everywhere for MVC-style routing is something like this: void Application_Start(object

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.