+ // let's calculate the max width
+ Optional<Integer> max = labels.stream().map(t -> g.getFontMetrics().stringWidth((String) t.c2)).max(Comparator.naturalOrder());
+ int width = max.orElse(10);
+ g.setColor(Color.WHITE);
+ int totalHeight = (int)Math.round(rowHeight * labels.size());
+ g.fillRect(-(W1 + PAD + W2 + 5), -(totalHeight + (int)Math.round(rowHeight)), (W1 + PAD + W2 + width + 10), totalHeight + 5);
+