views:

761

answers:

1

I have a custom cell renderer set in JTable and it works but instead an "x" visible on buttons being table cells I see "..." (three dots). What did I miss ??

  /***************************************************************************
 * Listener reagujący na dodanie nowej wartości
 **************************************************************************/
private static class ButtonRenderer extends JButton implements
  TableCellRenderer {
 /***********************************************************************
  * Konstruktor
  **********************************************************************/
 public ButtonRenderer() {
  super("x");
 }

 /***********************************************************************
  * @see TableCellRenderer#getTableCellRendererComponent(JTable, Object,
  *      boolean, boolean, int, int)
  **********************************************************************/
 public Component getTableCellRendererComponent(JTable table,
   Object value, boolean isSelected, boolean hasFocus, int row,
   int column) {
  return this;
 }

}
A: 

The size of the button isn't large enough to contain the rendered "x" plus the padding around it.

A solution would be to enlarge the table cell or reduce the padding (always assuming that the button has the same size as the table cell).

boutta