Methods Summary |
---|
private void | applyOrientation(java.awt.Component c, java.awt.ComponentOrientation o)
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 );
}
}
|
static ComponentOrientationChanger | create()
return new ComponentOrientationChanger();
|
private void | dumpOrientation(java.awt.Component c, int level)
ComponentOrientation o = c.getComponentOrientation();
for(int i=0; i<level; i++)
System.out.print("\t");
System.out.println(c + " isLTR=" + o.isLeftToRight() );
if( c instanceof Container ) {
Container container = (Container)c;
int ncomponents = container.getComponentCount();
for (int i = 0 ; i < ncomponents ; ++i) {
dumpOrientation( container.getComponent(i), level+1);
}
}
|
public void | itemStateChanged(java.awt.event.ItemEvent e)
JRadioButtonMenuItem rb = (JRadioButtonMenuItem) e.getSource();
if (rb.isSelected()) {
String selected = rb.getText();
ComponentOrientation orientation;
if (selected.equals("Left To Right")) {
orientation = ComponentOrientation.LEFT_TO_RIGHT;
} else {
orientation = ComponentOrientation.RIGHT_TO_LEFT;
}
Container swingRoot = SwingSet.sharedInstance().getRootComponent();
applyOrientation( swingRoot, orientation );
fireActionPerformed(new ActionEvent(this,0,"OrientationChanged"));
swingRoot.validate();
swingRoot.repaint();
}
|