Salve, ho il seguente problema e non riesco a venirne a capo, praticamente la situazione è questa: ho una JTable e un JPanel contenente 3 JButton (per l'editing della tupla, per la visualizzazione e per la rimozione). Faccio caricare il JPanel contenente i 3 JButton nella prima colonna di ogni riga della JTable al momento che interrogo un database MySql e fin qui tutto ok.
|(JButton1 JButton2 JButton3)| id tupla | ecc. | ecc.|....|
Il problema è che questi JButton non funzionano se visualizzati nella cella della JTable (come se la cella fosse proprio bloccata), suppongo che si debba realizzare un opportuno ascoltatore ma non ho idea di come fare, qualcuno ha qualche idea? E può postare qualche spunto...GRAZIE

POSTO UN PO' DI CODICE:

panelRenderer.Java

codice:
import java.awt.Component;
import javax.swing.JPanel;
import javax.swing.JTable;
import javax.swing.table.DefaultTableCellRenderer;

class PanelRenderer extends DefaultTableCellRenderer {
  
	public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column)
	{
		/* value è il valore conservato nel modello della tabella in corrispondenza
		della cella (row, column). Se quel valore è un JPanel restituisco direttamente
		quel JPanel come vista del contenuto, altrimenti uso la definizione standard di
		questo metodo */
		return value instanceof JPanel ?
			(JPanel)value :
			super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
	}
}
customTable.java
codice:
import javax.swing.JTable;
import javax.swing.table.TableCellRenderer;

public class customTableextends JTable {
	private PanelRenderer panelRenderer = new PanelRenderer();

	
	public TableCellRenderer getCellRenderer(int row, int column) {
		return column == 0 ?
			panelRenderer :
			super.getCellRenderer(row, column);
	}

	public boolean isCellEditable(int row, int column) {
		return column == 0 ?
			false :
			super.isCellEditable(row, column);
	}
}
panelButton.java

codice:
public class panelButton extends javax.swing.JPanel {

    /** Creates new form panelButton */
    public panelButton() {
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">
    private void initComponents() {

        buttonEdit = new javax.swing.JButton();
        buttonInfo = new javax.swing.JButton();
        buttonDel = new javax.swing.JButton();

        setBackground(new java.awt.Color(255, 255, 255));
        setPreferredSize(new java.awt.Dimension(80, 35));

        buttonEdit.setIcon(new javax.swing.ImageIcon(getClass().getResource("/programmatunisia/GraphicalUserInterface/images/edit16x16.png"))); // NOI18N
        buttonEdit.setBorderPainted(false);
        buttonEdit.setContentAreaFilled(false);

        buttonInfo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/programmatunisia/GraphicalUserInterface/images/info16x16.png"))); // NOI18N
        buttonInfo.setBorderPainted(false);
        buttonInfo.setContentAreaFilled(false);

        buttonDel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/programmatunisia/GraphicalUserInterface/images/del16x16.png"))); // NOI18N
        buttonDel.setBorderPainted(false);
        buttonDel.setContentAreaFilled(false);
        buttonDel.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buttonDelActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(buttonEdit, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(buttonInfo, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(buttonDel, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(buttonEdit, javax.swing.GroupLayout.DEFAULT_SIZE, 25, Short.MAX_VALUE)
                    .addComponent(buttonInfo, javax.swing.GroupLayout.DEFAULT_SIZE, 25, Short.MAX_VALUE)
                    .addComponent(buttonDel, javax.swing.GroupLayout.DEFAULT_SIZE, 25, Short.MAX_VALUE))
                .addContainerGap())
        );
    }// </editor-fold>

    private void buttonDelActionPerformed(java.awt.event.ActionEvent evt) {
       System.out.println("ciao");
    }
GRAZIE.........