g2d.setPaint(paint);
Set<RibbonTask> tasksWithTrailingSeparators = new HashSet<RibbonTask>();
// add all regular tasks except the last
for (int i = 0; i < ribbon.getTaskCount() - 1; i++) {
RibbonTask task = ribbon.getTask(i);
tasksWithTrailingSeparators.add(task);
// System.out.println("Added " + task.getTitle());
}
// add all tasks of visible contextual groups except last task in
// each group
for (int i = 0; i < ribbon.getContextualTaskGroupCount(); i++) {
RibbonContextualTaskGroup group = ribbon
.getContextualTaskGroup(i);
if (ribbon.isVisible(group)) {
for (int j = 0; j < group.getTaskCount() - 1; j++) {
RibbonTask task = group.getTask(j);
tasksWithTrailingSeparators.add(task);
// System.out.println("Added " + task.getTitle());
}
}
}