0
I have here a table template with four columns and several rows filled in which I take the database. I would like to create an Action button that copies columns 2 and 3 at once to the clipboard, and so be able to paste, for example, in an Excel or other places. It is possible?
Follow the Jtable model I’m wearing.
import java.util.ArrayList;
import javax.swing.table.AbstractTableModel;
public class MinhaTabelaEditavel extends AbstractTableModel {
private ArrayList linhas = null;
private String[] colunas = null;
public MinhaTabelaEditavel (ArrayList lin, String[] col){
setLinhas(lin);
setColunas(col);
}
public ArrayList getLinhas() {
return linhas;
}
public void setLinhas(ArrayList dados) {
this.linhas = dados;
}
public String[] getColunas() {
return colunas;
}
public void setColunas(String[] nome) {
this.colunas = nome;
}
public int getColumnCount(){
return colunas.length;
}
public int getRowCount (){
return linhas.size();
}
public String getColumnName (int numCol){
return colunas[numCol];
}
public Object getValueAt (int numLin, int numCol){
Object[] linha = (Object[])getLinhas().get(numLin);
return linha[numCol];
}
@Override
public boolean isCellEditable(int row, int column) {
return true;
}
Please provide a [mcve] of your table with some data. This code is not executable.
– user28595