Java JComboBox fixComboOrientation(JComboBox combo)

Here you can find the source of fixComboOrientation(JComboBox combo)

Description

Fixes the orientation of the renderer of a combo box.

License

BSD License

Parameter

Parameter Description
combo The combo box.

Declaration

public static void fixComboOrientation(JComboBox combo) 

Method Source Code

//package com.java2s;
/*/*from w  ww  .  java  2 s .  co m*/
 * 09/08/2005
 *
 * UIUtil.java - Utility methods for org.fife.rsta.ui classes.
 * This library is distributed under a modified BSD license.  See the included
 * RSTAUI.License.txt file for details.
 */

import java.awt.Component;
import java.awt.ComponentOrientation;

import java.util.Locale;

import javax.swing.JComboBox;

import javax.swing.ListCellRenderer;

public class Main {
    /**
     * Fixes the orientation of the renderer of a combo box.  I can't believe
     * Swing standard LaFs don't handle this on their own.
     *
     * @param combo The combo box.
     */
    public static void fixComboOrientation(JComboBox combo) {
        ListCellRenderer r = combo.getRenderer();
        if (r instanceof Component) {
            ComponentOrientation o = ComponentOrientation.getOrientation(Locale.getDefault());
            ((Component) r).setComponentOrientation(o);
        }
    }
}

Related

  1. contains(JComboBox jcb, Object o, boolean caseSensitive)
  2. createLabelCombo(String label, JComboBox comboBox)
  3. disableListenersForComboBox(JComboBox comboBox)
  4. ensureCustomBackgroundStored(JComboBox comp)
  5. exist(JComboBox x)
  6. generateComboBoxFor(Object... objs)
  7. getAgeComboBox()
  8. getComboBoxDisabledBackground()
  9. getEOL(JComboBox eolCombo)