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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T05:45:54+00:00 2026-05-18T05:45:54+00:00

i am using jtable swing, there is checkbox inside jtable of mine, what would

  • 0

i am using jtable swing, there is checkbox inside jtable of mine, what would be the best way to removeRow of checked checkbox only?

i am using defaultTableModel and removeRow, i need to know how to get the TRUE value of ticked checkbox.

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

    When you set a JCheckBox to the cell editor, then you can read its value as Boolean.

    class TableModel extends DefaultTableModel { 
    
      public TableModel(Object[] headers) { 
        super(null, headers);
      } 
    
      public Class getColumnClass(int c) { 
        switch (c) { 
          case 0: return Boolean.class;
          default: return String.class; 
        } 
      } 
    
      public boolean isCellEditable(int row, int column) { 
        if (column == 0) return true;
        return false;
      } 
    }
    
    TableModel tableModel = new TableModel(<headers as String []>);
    JTable table = new JTable(tableModel);
    ....
    
    TableColumnModel columnModel = table.getColumnModel();
    // setting the first column to use checkboxes
    columnModel.getColumn(0).setCellEditor(new DefaultCellEditor(new JCheckBox()));
    ...
    
    int rowCount = tableModel.getRowCount();
    for(int i=0; i<rowCount; i++) {
      Boolean selected = (Boolean)tableModel.getValueAt(0, 0);
      if(selected) {
        tableModel.removeRow(0);
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using C# and System.Data.SqlClient, is there a way to retrieve a list of parameters
I need to build a Swing GUI like this GUI Mockup http://img199.imageshack.us/img199/7271/mockupl.png where there
JAVA NETBEANS // resultsTable, myModel JTable resultsTable; DefaultTableModel myModel; //javax.swing.table.DefaultTableModel myModel = (DefaultTableModel) resultsTable.getModel();
In Swing when using a JTree/JList/JTable selecting an item changes its background color. Is
Using online interfaces to a version control system is a nice way to have
Using ASP.NET MVC there are situations (such as form submission) that may require a
Using C#, I need a class called User that has a username, password, active
Using preview 4 of ASP.NET MVC Code like: <%= Html.CheckBox( myCheckBox, Click Here, True,
I develop a number of desktop Java applications using Swing, and while Swing is
I'm currently working on a (rather large) pet project of mine , a Swing

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.