Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4524273

TextField cursor disappears after calling toFront() on Applet parent Frame

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.4.0
    • client-libs



      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)
      ======================================================================

            svioletsunw Scott Violet (Inactive)
            ddressersunw Daniel Dresser (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: