List of usage examples for java.awt Component setComponentOrientation
public void setComponentOrientation(ComponentOrientation o)
From source file:Main.java
public static void changeComonentOrientation(Component[] components, ComponentOrientation orientation) { for (Component c : components) { c.setComponentOrientation(orientation); if (c instanceof java.awt.Container) changeComonentOrientation(((java.awt.Container) c).getComponents(), orientation); }// w ww . ja va2 s. c o m }
From source file:MainClass.java
private void applyOrientation(Component c, 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); }//from w w w .j av a 2s .co m } 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); } } }
From source file:Main.java
@Override public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { Component component = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); component.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); return component; }
From source file:Main.java
private void setListCellRendererOf(JComboBox comboBox) { comboBox.setRenderer(new ListCellRenderer() { @Override/*w ww . j av a2s . c om*/ public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { Component component = new DefaultListCellRenderer().getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); component.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); return component; } }); }