FIX: Text Components Are Not Brighter for Editable Controls

ID: Q178645

The information in this article applies to:

SYMPTOMS

The java.awt.TextArea and java.awt.TextField controls do not use a brighter color when they can be edited.

CAUSE

In builds of the Virtual Machine for Java prior to 2252 a brighter color was used to represent an editable control.

RESOLUTION

See the sample code below for a potential workaround.

STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This problem has been fixed in Internet Explorer 4.01 Service Pack 1, and SDK for Java 2.02.

MORE INFORMATION

The sample code below illustrates the problem and a potential way to workaround the problem by calling brighter():

   import com.ms.ui.*;
   import java.awt.*;

   class test {
     public static void main(String args[])
     {
     java.awt.Color c = new java.awt.Color(255,40,168);

     Frame f = new Frame("AWT Frame");
     f.setSize(320,200);
     f.setLayout(new GridLayout(3,0));

     TextArea edit1=new TextArea("Read Only");
     TextArea edit2=new TextArea("Editable (Should match brighter color)");
     TextArea edit3=new TextArea("Brighter");

     edit1.setBackground(c);
     edit1.setEditable(false);

     edit2.setBackground(c);
     edit2.setEditable(true);

     // workaround:  set background to brighter color.
     edit3.setBackground(c.brighter());
     edit3.setEditable(true);

     f.add(edit1);
     f.add(edit2);
     f.add(edit3);
     f.setVisible(true);
     }
   }

NOTE: In the Application Foundation Classes (AFC), the UIEdit control does not change color when it is editable.

REFERENCES

For the latest Knowledge Base articles and other support information on Visual J++ and the SDK for Java, see the following page on the Microsoft Technical Support site:

   http://support.microsoft.com/support/visualj/ 
   http://support.microsoft.com/support/java/ 

Keywords          : kbcode AWTPkg JVM JAFC 
Version           : WINDOWS:2.0,2.01,4.0,4.01
Platform          : WINDOWS
Issue type        : kbbug
Solution Type     : kbfix

Last Reviewed: November 13, 1998