by gtt » Thu Mar 03, 2022 11:23 am
Thank you for prompt reaction,
so i switched to 3.7.13 but unfortunatly nothing changed.
Again: This ist the very very simple example that produces a non complete text "Mein"
if i use JideComboBox.
Switching to JComboBox it shows a complete Text, fine.
Example 1:
public class JideComboBoxtest {
public static void main(String[] args) {
// This text is not displayed completely
String [] items = {"Mein"};
JideComboBox cb = new JideComboBox(items);
// JComboBox cb = new JComboBox(items);
JFrame frame = new JFrame();
JPanel panel = new JPanel(new FlowLayout());
panel.add(cb);
frame.add(panel);
frame.pack();
frame.setVisible(true);
}
}
Example 2: This is also very important : Only a little bit more complex.
JComboxBox renders fine, JideComboBox doesnt.
public class JideComboBoxtest {
public static void main(String[] args) {
// This text is not displayed completely
String [] items = {"Mein"};
JideComboBox cb = new JideComboBox(items);
// JComboBox cb = new JComboBox(items);
cb.setRenderer(new BorderListCellRenderer(20));
JFrame frame = new JFrame();
JPanel panel = new JPanel(new FlowLayout());
panel.add(cb);
frame.add(panel);
frame.pack();
frame.setVisible(true);
}
static class BorderListCellRenderer implements ListCellRenderer {
private Border insetBorder;
private DefaultListCellRenderer defaultRenderer;
public BorderListCellRenderer(int rightMargin) {
this.insetBorder = new EmptyBorder(0, 2, 0, rightMargin);
this.defaultRenderer = new DefaultListCellRenderer();
}
@Override
public Component getListCellRendererComponent(JList list, Object value,
int index, boolean isSelected, boolean cellHasFocus) {
JLabel renderer = (JLabel) defaultRenderer
.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
renderer.setBorder(insetBorder);
JPanel p = new JPanel(new BorderLayout());
p.add(BorderLayout.CENTER, new JLabel(value.toString()));
p.add(BorderLayout.EAST, new JLabel(NamedIcon.ARROW_DOWN.getImageIcon()));
return p;
}
}
}