c.setComponentOrientation(o);
if (c instanceof JMenu) {
JMenu menu = (JMenu)c;
int ncomponents = menu.getMenuComponentCount();
for (int i = 0; i < ncomponents; ++i) {
applyOrientation(menu.getMenuComponent(i), o);
}
} else if (c instanceof Container) {
Container container = (Container)c;
int ncomponents = container.getComponentCount();
for (int i = 0; i < ncomponents; ++i) {
applyOrientation(container.getComponent(i), o);
}
}