Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.

public class DefaultGridCellRenderer

  1. Object
  2. DefaultGridCellRenderer

ImplementsGridCellRenderer

The renderer a DataGrid uses for a column that has none: text aligned by kind, a check box for a boolean, and an image scaled to the row.

Subclass it to change one thing, such as the colour of a value, without repainting the rest.

Constructors

public DefaultGridCellRenderer()

Methods

public void paint(Graphics g, GridCell cell, int x, int y, int width, int height)Paints a cell into the rectangle x, y, width, height.
public int getPreferredWidth(GridCell cell)The width, in pixels, the cell’s content needs, for a column that sizes itself to what it shows.
protected String text(GridCell cell)The text a cell shows; by default its column’s format of the value.
protected int textColor(GridCell cell, int defaultColor)The colour of a cell’s text, given the row style’s.
protected Font font(GridCell cell)The font of a cell’s text; by default the row style’s.
protected void paintCheck(Graphics g, GridCell cell, int x, int y, int size, boolean on)Paints a check box of side size at x, y.
protected static int mirror(int align, boolean rtl)align as it reads in the grid’s direction: right to left, LEFT is the right edge and RIGHT the left one, so text starts and numbers end where the language puts them.
protected static int place(int align, int x, int avail, int w)Where something w wide starts in a span from x, avail wide.

Inherited methods

Constructor details

DefaultGridCellRenderer

public DefaultGridCellRenderer()

Method details

paint

public void paint(Graphics g, GridCell cell, int x, int y, int width, int height)
Paints a cell into the rectangle x, y, width, height. The graphics is clipped to it.

getPreferredWidth

public int getPreferredWidth(GridCell cell)
The width, in pixels, the cell’s content needs, for a column that sizes itself to what it shows.

text

protected String text(GridCell cell)
The text a cell shows; by default its column’s format of the value.

textColor

protected int textColor(GridCell cell, int defaultColor)
The colour of a cell’s text, given the row style’s.

font

protected Font font(GridCell cell)
The font of a cell’s text; by default the row style’s.

paintCheck

protected void paintCheck(Graphics g, GridCell cell, int x, int y, int size, boolean on)
Paints a check box of side size at x, y.

mirror

protected static int mirror(int align, boolean rtl)
align as it reads in the grid’s direction: right to left, LEFT is the right edge and RIGHT the left one, so text starts and numbers end where the language puts them.

place

protected static int place(int align, int x, int avail, int w)
Where something w wide starts in a span from x, avail wide.