Skip to content

ocadaruma/lowtable

Repository files navigation

lowtable

Super simple swing component to render tables.

Example

Installation

Add com.mayreh.lowtable:lowtable:$VERSION to the dependency.

Usage

TableData data = TableData
        .builder()
        .header("target", "metricA", "metricB")
        .addRow(Cell.of("foo"),
                Cell.of("99.9999", TableCellStyle.builder().background(Defaults.SUCCESS_LIGHT).build()),
                Cell.of("0.1", TableCellStyle.builder().background(Defaults.DANGER_LIGHT).build()))
        .addRow(Cell.of("bar"),
                Cell.of("1300000", TableCellStyle.builder().background(Defaults.SUCCESS_LIGHT).build()),
                Cell.of("99", TableCellStyle.builder().background(Defaults.SUCCESS_LIGHT).build()))
        .build();

Table table = new Table(TableStyle.DEFAULT, data);
table.setAutoSize();
table.saveAsPNG(file);