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

Label takes input focus with "follow mouse" focus policy

XMLWordPrintable

    • generic
    • solaris_2.6

      ###@###.### 2000-11-08

      to reproduce bug:
      1. set follow-mouse focus policy in CDE
      2. compile and run program (see below)
      3. place mouse pointer on frame
      4. press any key

      import java.applet.*;
      import java.awt.*;
      import java.awt.event.*;
      import java.io.*;

      public class keytest extends Frame implements WindowListener {

          private Label glc = null;

          public static void main( String argv[] ) {
              keytest d = new keytest();
              d.setTitle( d.getName() );
              d.startDemo();
            }

          public keytest() {
                  /**#start */
          }

          public Frame getFrame() {
              return ( this );
          }

          public void startDemo() {

              /** Set the layout of the frame */
              setLayout( new BorderLayout() );

              glc = new Label( "Testing" );

              /** Add the Component into the window */
              add( "Center", glc );
              pack(); show();

              /** Register the keyboard listener */
              KeyListener kl = new KeyAdapter() {
                          public void keyPressed( KeyEvent evt ) {
                              System.err.println( "keyPressed :" + evt.getKeyChar() );
                                 }
                          }
              };
              glc.addKeyListener( kl );

              this.addWindowListener( this );
            }

          /** WindowListener methods */
          public void windowActivated( WindowEvent evt ) {
            }
          public void windowClosed( WindowEvent evt ) {
            }

          public void windowClosing( WindowEvent evt ) {
              dispose();
              System.exit( 0 );
          }

          public void windowDeactivated( WindowEvent evt ) {
          }
          public void windowDeiconified( WindowEvent evt ) {
          }
          public void windowIconified( WindowEvent evt ) {
          }
          public void windowOpened( WindowEvent evt ) {
          }
      }

            dmikhalksunw Denis Mikhalkin (Inactive)
            son Oleg Sukhodolsky (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: