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 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

I am using DefaultTable Model for showing my records in Jtable.But there is a
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
I'm subclassing JTable and using a DefaultTableModel to model my table data. The following
Is there any way to detect a cell selection change in a JTable? I've
I need to build a Swing GUI like this GUI Mockup http://img199.imageshack.us/img199/7271/mockupl.png where there
How do i sort jtable column using radio button? my jtable is defaultTableModel not
I am currently building a database using JTable and DefaultTableModel. In my program I
I have a GUI with a JTable using the DefaultTableModel. These instance variables are
I'm using TableLayout for my swing GUI. Initially only some basic labels, buttons and

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.