Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to mimic radio button behaviour in JTable with boolean datatype
    primarykey
    data
    text
    <pre><code>package com.tweeteye.gui.model; import java.util.ArrayList; import java.util.List; import javax.swing.table.AbstractTableModel; import com.tweeteye.entity.ImageRecord; import com.tweeteye.entity.enumiration.SearchTypeEnum; import com.tweeteye.gui.MainWindow; import javax.swing.ImageIcon; public class ImageTableModel extends AbstractTableModel { private static final long serialVersionUID = 1669175969068584634L; protected SearchTypeEnum type; public List&lt;ImageRecord&gt; dataList = new ArrayList&lt;ImageRecord&gt;(); @SuppressWarnings("rawtypes") private Class[] columnTypes = { java.lang.Boolean.class,javax.swing.ImageIcon.class, javax.swing.ImageIcon.class, java.lang.Object.class }; private String[] columnNames = {"Select","Logo","Image","Title"}; public List&lt;ImageRecord&gt; getData() { return dataList; } public void setData(List&lt;ImageRecord&gt; dataList) { this.dataList = dataList; } @SuppressWarnings({ "rawtypes", "unchecked" }) @Override public Class getColumnClass(int column) { return columnTypes[column]; } public String getColumnName(int col) { return columnNames[col].toString(); } public void setValueAt(Object arg0, int arg1, int arg2) { ImageRecord imageRecord=dataList.get(arg1); if (arg2 == 0) { imageRecord.setSelected((Boolean) arg0); } fireTableCellUpdated(arg1, arg2); } public Object getValueAt(int arg0, int arg1) { if (arg1 == 0) return dataList.get(arg0).getSelected(); if (arg1 == 1) return dataList.get(arg0).getImage(); else return dataList.get(arg0).getTitle(); } @Override public boolean isCellEditable(int row, int column) { if (column == 0) return true; else return false; } public int getColumnCount() { return columnTypes.length; } public int getRowCount() { return dataList.size(); } public SearchTypeEnum getType() { return type; } public void setType(SearchTypeEnum type) { this.type = type; } } </code></pre> <p>Now I want to make only one check box select-able in the column "Selected". I am fetching product information from eBay and displaying it in table, my 1st column contains check box, But I want radio button.How can this be done.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload