JDK-4524273 : TextField cursor disappears after calling toFront() on Applet parent Frame
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 1.4.0
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_nt
  • CPU: x86
  • Submitted: 2001-11-07
  • Updated: 2001-11-07
  • Resolved: 2001-11-07
Related Reports
Duplicate :  
Description

Name: ddT132432			Date: 11/07/2001


java version "1.3.1_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1_01)
Java HotSpot(TM) Client VM (build 1.3.1_01, mixed mode)

When calling toFront() on the parent Frame of an applet, the cursor disappears
and cannot be set on a JTextField that is contained within the applet.
Clicking on another application and then back on the applet causes the
cursor/caret to reappear.  Here is some sample code that can be used to
reproduce the problem.  Type some input into the textfield, then push the
button.  Try to type into the text field again!

This problem also occurs when using JDk1.4beta3

import java.awt.*;
import java.awt.event.*;
import java.applet.*;
import javax.swing.*;

public class MyApplet extends JApplet {
  JButton myButton = new JButton("Push me");
  JTextField tf = new JTextField(20);

  public void init() {
    getContentPane().setLayout( new java.awt.FlowLayout() );
    myButton.addActionListener( new ToFrontHandler() );
    getContentPane( ).add( myButton );
    getContentPane( ).add( tf );
  }

  Frame getParentFrame() {
    return (Frame) SwingUtilities.getAncestorOfClass( Frame.class, this );
  }

  class ToFrontHandler implements ActionListener {
    public void actionPerformed(ActionEvent e) {
      Frame frame = getParentFrame();
      frame.toFront();
    }
  }
}
(Review ID: 134616) 
======================================================================

Comments
WORK AROUND Name: ddT132432 Date: 11/07/2001 none--please contact me if you know of one!!! ======================================================================
11-06-2004

EVALUATION This is no longer reproducible with 1.4 and is likely a result of the focus changes. ###@###.### 2001-11-07
07-11-2001