use of org.eclipse.nebula.widgets.nattable.painter.cell.ButtonCellPainter in project nebula.widgets.nattable by eclipse.
the class Rendering_cells_as_a_link_and_button method addButtonToColumn.
private void addButtonToColumn(IConfigRegistry configRegistry) {
this.buttonPainter = new ButtonCellPainter(new CellPainterDecorator(new TextPainter(), CellEdgeEnum.RIGHT, new ImagePainter(GUIHelper.getImage("preferences"))));
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, this.buttonPainter, DisplayMode.NORMAL, BUTTON_CELL_LABEL);
// Add your listener to the button
this.buttonPainter.addClickListener(new MyMouseAction());
// Set the color of the cell. This is picked up by the button painter to
// style the button
Style style = new Style();
style.setAttributeValue(CellStyleAttributes.BACKGROUND_COLOR, GUIHelper.COLOR_WHITE);
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, style, DisplayMode.NORMAL, BUTTON_CELL_LABEL);
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, style, DisplayMode.SELECT, BUTTON_CELL_LABEL);
}
Aggregations