Java examples for Swing:JComboBox
Fixes the orientation of the renderer of a combo box.
/*//from w ww . j a v a2 s . c o m * 09/08/2005 * * UIUtil.java - Utility methods for org.fife.ui classes. * Copyright (C) 2005 Robert Futrell * http://fifesoft.com/rtext * Licensed under a modified BSD license. * See the included license file for details. */ //package com.java2s; 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); } } }