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

Keyboard code page self-switching when window closes

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 1.4.0
    • 1.3.1
    • client-libs
    • beta
    • x86
    • windows_nt



      Name: rmT116609 Date: 02/16/2001


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

      I have Win NT4.0SP6(Russian).

       When a new window is opened, kbd codepage remains unchanged (thanks, bug #4312168 is fixed).

      BUT if user switches to Russian (default codepage is English), then opens another new window
      (dialog for example) and switches there to English and closes this window, codepage in parent
      window becomes Russian again !

      Interesting that if user begins with English codepage and switches in child window to Russian,
      programs works fine - codepage remains Russian in parent window also.

      Here is example of such program (but, please, test it on localized WinNT4.0 version, not English).

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

      class TestCpSwitch {

      protected JFrame frMain;
      protected JDialog dlgMain;


      // Top entry

      public static void main( String args[] )
      {
      new TestCpSwitch();
      }

      // Constructor

      public TestCpSwitch()
      {
      frMain = new JFrame( "Test keyboard codepage switching" );

      // Way to exit

      frMain.addWindowListener( new WindowAdapter() {

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

      // Add components

      {
      JButton jbShow = new JButton( "Show dialog" );


      frMain.getContentPane().add( jbShow, BorderLayout.NORTH );

      frMain.getContentPane().add( createTextLb( "<html>Switch codepage to Russian (or other language)<br>" +
      "than press button 'Show dialog' and switch to English.<br>" +
      "After closing dialog code page will switch itself to Russian again." ), BorderLayout.CENTER );

      jbShow.addActionListener( new ActionListener() {

      public void actionPerformed( ActionEvent evt )
      {
      createDialog();
      dlgMain.show();
      }
      } );
      }
      frMain.pack();
      frMain.setLocation( 200, 200 );

      frMain.show();
      Thread.yield();
      }

      // Creates dialog window

      private void createDialog()
      {
      dlgMain = new JDialog( frMain, "Test dialog", true );

      dlgMain.getContentPane().add( createTextLb(
      "Switch codepage to english and close dialog" ),BorderLayout.CENTER );
      dlgMain.pack();
      dlgMain.setLocationRelativeTo( frMain );

      dlgMain.addWindowListener( new WindowAdapter() {

      public void windowClosing( WindowEvent evt )
      {
      dlgMain.dispose();
      dlgMain = null;
      }
      } );
      }

      // Creates label with border

      private static JLabel createTextLb( String sText )
      {
      JLabel lbNew = new JLabel( sText );


      lbNew.setBorder( BorderFactory.createEmptyBorder( 10, 10, 10, 10 ) );
      return lbNew;
      }
      }
      (Review ID: 117112)
      ======================================================================

            naoto Naoto Sato
            rmandalasunw Ranjith Mandala (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: