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

setEchoChar causes incorrect actions. (Solaris ONLY)

XMLWordPrintable

    • beta
    • sparc
    • solaris_2.6



      Name: krT82822 Date: 01/25/2000


      25 Jan 2000 eval1127@eng -- same behavior (under Solaris) with everything from JDK 1.1.6 to kestrel RC1-T (1.3.0rc1-T). Trying win32...works fine there,
      under 1.1.7 and onward.

      This is related to bug #'s 4124697, 4080608, both of which are closed. Need to open another bug to make sure this gets reviewed (again).

      ----------------------
      $ java -version
      java version "1.1.6"

      The test case is given below on excuting this program .
      setEchoChar behaves abnormally and text can't be entered .

      When first if you start entering in the text area , it works fine .
      but if You click on the checkbox and then back again to Text area
      this problem is seen. It can be observed that when a check box is clicked
      both TextListener as well as ItemListener are invoked , this is not
      observed in windows platform where it works fine.

      This was seen on
      Sun SOlaris machine ,

      % uname -a
      SunOS sherlock 5.7 Generic_106541-02 sun4u sparc SUNW,Ultra-5_10



      ********************************************************************************
      TEST PROGRAM
      ********************************************************************************

      import java.awt.*;
      import java.awt.event.*;

      public class Main extends Frame implements ItemListener, TextListener{
         private TextField PasswordEntry = null;
         private Label Password = null;
         private Checkbox HidePassword = null;
       public Main()
        {
              setLayout(new GridLayout(2,2));
              setBounds(10,10,300,100);
              Password = new Label("Password:");
              add(Password);
              PasswordEntry = new TextField();
              PasswordEntry.setEchoChar('*');
              add(PasswordEntry);
              PasswordEntry.addTextListener(this);
              HidePassword = new Checkbox("Hide the password",true);
              add(HidePassword);
              HidePassword.addItemListener(this);
         }

      public void itemStateChanged(ItemEvent event) {
                           Object source = event.getSource();
       // set the echoChar if checked...
            if (source == HidePassword)
               {
                      if (HidePassword.getState())
                      { PasswordEntry.setEchoChar('*');
             }
               else {
              // setting echoChar to 0 unsets it...
                PasswordEntry.setEchoChar((char)0);
             }
            }
         }

         public void textValueChanged(TextEvent event) {
           Object source = event.getSource();
        if (source == PasswordEntry)
       { System.out.println("PasswordEntry text changed");
                    }
        }
       public static void main(String[] args) {
           try {
             Main aMain = new Main();
           aMain.setVisible(true);
           }
       catch (Throwable exception)
          {
        System.err.println("Exception occurred in main() of Main" + exception);
        System.exit(0); }
         }
      }

      *******************************************************************************
      (Review ID: 100321)
      ======================================================================

            dassunw Das Das (Inactive)
            kryansunw Kevin Ryan (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: