orig synopsis:
"java 1.1.x on win32 allows multiple simultaneous TextFields with selections"
Using JDK 1.1.5 in win32, create an application with two
java.awt.TextField's
Select text in the first one, then "tab" to the second one.
Selecting text there ought to de-select text in the first one but
it does not
Similarly if you programmatically request that the text in both text
fields, both appear selected.
User interfaces should allow only one component to have the primary
text selection at a time.
It makes it impossibe for say a "Copy" menu item to decide which
item to Copy
None of this wrong behaviour happens on X - the bug is specific to win32
Also apart from breaking cross-platform portability its probably
difficult to even force this behaviour on X/Motif because the toolkit
will do the correct thing for you
Test case included herewith
// TextSel.java
import java.awt.*;
import java.awt.event.*;
public class TextSel extends Frame {
TextField tf1, tf2;
public static void main(String args[]) {
TextSel ts = new TextSel();
ts.setVisible(true);
ts.tf1.selectAll();
ts.tf2.selectAll();
}
public TextSel() {
super("Text Selection");
addWindowListener( new WindowAdapter()
{ public void windowClosing( WindowEvent e )
{ System.exit(0);
}
} );
add("North", tf1 = new TextField("some text"));
add("South", tf2 = new TextField("more text"));
pack();
}
}