Re: Can the content of JComboBox be RightAlignment
- From: Roland de Ruiter <roland.de.ruiter@xxxxxxxxxxxxxxx>
- Date: Mon, 27 Feb 2006 12:31:48 +0100
cl wrote:
Hi,everybodyA ListCellRenderer takes care of rendering the combobox items. Class
As the title, is there any methods?
I just tried, but no finding.
regards,
poorrichard
BasicComboBoxRenderer (the default implementation of the
ListCellRenderer interface) extends JLabel. For right alignment, you
could try the following code
<untested>
JComboBox yourComboBox = new JComboBox();
ListCellRenderer itemRenderer = yourComboBox.getRenderer();
if (itemRenderer instanceof JLabel) {
JLabel itemRendererLabel = (JLabel)itemRenderer;
itemRendererLabel.setHorizontalAlignment(SwingConstants.RIGHT);
}
</untested>
Regards,
Roland
.
- References:
- Prev by Date: Can the content of JComboBox be RightAlignment
- Next by Date: Re: Can the content of JComboBox be RightAlignment
- Previous by thread: Can the content of JComboBox be RightAlignment
- Next by thread: Re: Can the content of JComboBox be RightAlignment
- Index(es):