-
Bug
-
Resolution: Unresolved
-
P4
-
None
-
1.4.0
-
generic
-
generic
Name: bsC130419 Date: 07/16/2001
java version "1.4.0-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta-b65)
Java HotSpot(TM) Client VM (build 1.4.0-beta-b65, mixed mode)
An editable JComboBox will change newlines into spaces for selected items and
for pasted-in (cut and paste) text. This is not acceptable behavior. I'm using
JComboBoxes for a "find" function, and the user must be able to search for
newlines. The correct behavior would be to show the newline as a square, as is
done in the pulldown list. That is also the way Motif, for example, handles it.
This was broken in 1.3.1 also, but in a nicer way - multiple lines were shown
(the bug was visual rather than functional). Example code follows - select the
second item or paste in a newline.
import javax.swing.*;
public class JComboBoxBug {
public static void main(String args[]) {
JDialog dialog = new JDialog();
JComboBox cb = new JComboBox();
cb.setEditable(true);
cb.addItem("test");
cb.addItem("line1\nline2");
dialog.getContentPane().add(cb);
dialog.pack();
dialog.setVisible(true);
}
}
(Review ID: 128121)
======================================================================