/**
 * The MIT License
 *
 * Copyright (C) 2015 Asterios Raptis
 *
 * Permission is hereby granted, free of charge, to any person obtaining
 * a copy of this software and associated documentation files (the
 * "Software"), to deal in the Software without restriction, including
 * without limitation the rights to use, copy, modify, merge, publish,
 * distribute, sublicense, and/or sell copies of the Software, and to
 * permit persons to whom the Software is furnished to do so, subject to
 * the following conditions:
 *
 * The above copyright notice and this permission notice shall be
 * included in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */
package de.alpharogroup.swing.table.editor;

import java.awt.Component;

import javax.swing.DefaultCellEditor;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JOptionPane;
import javax.swing.JTable;

import lombok.Getter;
import lombok.Setter;

/**
 * The class {@link TableCellButtonEditor}.
 */
@Getter
@Setter
public class TableCellButtonEditor extends DefaultCellEditor
{

	/** The button. */
	private JButton button;

	/** The flag if the button was clicked. */
	private boolean clicked;

	/** The row index. */
	private int row;

	/** The value. */
	private Object value;

	/** The column index. */
	private int column;

	/**
	 * Instantiates a new {@link TableCellButtonEditor} object.
	 *
	 * @param checkBox
	 *            the check box
	 */
	public TableCellButtonEditor(JCheckBox checkBox)
	{
		super(checkBox);
		setButton(new JButton());
		getButton().setOpaque(true);
		getButton().addActionListener(e -> {
			onClick();
			fireEditingStopped();
		});
	}

	/**
	 * {@inheritDoc}
	 */
	@Override
	public Object getCellEditorValue()
	{
		if (isClicked())
		{
			JOptionPane.showMessageDialog(button, "You clicked the button with the value "
				+ this.value + " in row index " + row + " and in colunm index " + column + ".");
		}
		setClicked(false);
		String text = "";
		if (getValue() != null)
		{
			text = getValue().toString();
		}
		return text;
	}

	/**
	 * {@inheritDoc}
	 */
	@Override
	public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected,
		int row, int column)
	{
		setRow(row);
		setColumn(column);
		setValue(value);
		if (isSelected)
		{
			getButton().setForeground(table.getSelectionForeground());
			getButton().setBackground(table.getSelectionBackground());
		}
		else
		{
			getButton().setForeground(table.getForeground());
			getButton().setBackground(table.getBackground());
		}
		String text = "";
		if (value != null)
		{
			text = getValue().toString();
		}
		getButton().setText(text);
		setClicked(true);
		return getButton();
	}

	/**
	 * Callback method to interact when the button is clicked.
	 */
	protected void onClick()
	{

	}

	/**
	 * {@inheritDoc}
	 */
	@Override
	public boolean stopCellEditing()
	{
		setClicked(false);
		return super.stopCellEditing();
	}
}
@@ -1545,16 +1545,106 @@
 itor%0A%7B%0A%0A
+%09/** The Constant serialVersionUID. */%0A%09private static final long serialVersionUID = 1L;%0A%0A
 %09/** The
@@ -2039,16 +2039,22 @@
 nEditor(
+final 
 JCheckBo
@@ -2718,16 +2718,22 @@
 mponent(
+final 
 JTable t
@@ -2737,16 +2737,22 @@
 e table,
+ final
  Object 
@@ -2757,16 +2757,22 @@
 t value,
+ final
  boolean
@@ -2790,16 +2790,22 @@
 ,%0A%09%09
+final 
 int row,
  int
@@ -2800,16 +2800,22 @@
 int row,
+ final
  int col

remove warning