problem with jcombobox
hi friends,
in a frame i put a jcombobox and i want that data it it becomes from the right to the left.
i tried the famous SetComponentOrientation() but really it didn't give me the solution because only the combobox changes direction howerer the data in the combo still from the left to the right.
i wish that you help me
[348 byte] By [
mahrez85a] at [2007-11-27 6:36:48]

# 3
if the comboBox is editable, get the editor component (the textfield), then
textField.setHorizontalAlignment(JTextField.RIGHT);
this will have the effect of (if typing 1 2 3)
[ 123]
not
[ 321]
if uneditable, set your own renderer, casting the renderer component to a JLabel, then
label.setHorizontalAlignment(JLabel.RIGHT);
# 5
hi,
i find the solution.
jComboBox1.setRenderer(new DefaultListCellRenderer() {
/** {@ineheritDoc}
*/
@Override public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
setHorizontalAlignment(RIGHT); //voir commentaires plus bas.
return this;
}
});