use of org.apache.pivot.wtk.Menu in project pivot by apache.
the class TerraMenuSkin method paint.
@Override
public void paint(Graphics2D graphics) {
super.paint(graphics);
Menu menu = (Menu) getComponent();
int width = getWidth();
int height = getHeight();
// Paint the margin
if (marginColor != null) {
graphics.setColor(marginColor);
graphics.fillRect(0, 0, margin, height);
}
Menu.SectionSequence sections = menu.getSections();
for (int i = 0, n = sections.getLength(); i < n; i++) {
Menu.Section section = sections.get(i);
if (section.getLength() > 0) {
Menu.Item item = section.get(section.getLength() - 1);
int separatorY = item.getY() + item.getHeight() + sectionSpacing / 2;
// Paint the line
graphics.setColor(separatorColor);
graphics.drawLine(1, separatorY, width - 2, separatorY);
}
}
}
Aggregations