JDK-4091505 : win32: multiple AWT TextFields can be selected simultaneously
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 1.1.5,1.2.0
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_95,windows_nt
  • CPU: x86
  • Submitted: 1997-11-08
  • Updated: 2000-03-24
  • Resolved: 2000-03-24
Related Reports
Duplicate :  
Duplicate :  
Description
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();
  }
}

Comments
EVALUATION Name: ksT78225 Date: 07/23/98 23rd July 1998. ksT78225 ###@###.### Tested and the observations are as below: WinNT 4.0: JDK1.1.7B and JDK1.2beta4H : Able to select the text in both the TextFields. Solaris 2.6: JDK1.1.7B : The problem doesn't exists but only the Frame TitleBar is visible; we have to resize for the same code. JDK1.2beta4J: The problem doesn't exists. ====================================================================== 3/23/2000 kevin.ryan@eng -- win32-specific, but not limited to 1.1.x. Same behavior observed on 1.2.2-001 and kestrel-rc2 (1.3.0rc2-Y) on NT 4.0. The underlying cause is documented in bug #4095946. Since that bug is already in "committed" state, I'm duping this bug to #4095946. ---------
11-06-2004

WORK AROUND Difficult, maybe impossible. You would need to clear the previous selection yourself, when a new selection is started, but there are no events to tell you about selections being made or lost.
11-06-2004