Microsoft KB Archive/188448

= FIX: Setting Colors for List/Choice Control Fails =

Article ID: 188448

Article Last Modified on 7/23/2001

-

APPLIES TO


 * Microsoft Java Virtual Machine

-



This article was previously published under Q188448



SYMPTOMS
When trying to change the color of the List or Choice control using SetBackground and SetForeground, you will notice that it does not set the colors properly.



STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This bug has been corrected in the Java Virtual Machine distributed with Internet Explorer 4.01 Service Pack 1 and later.



Steps to Reproduce Behavior
  Save the following to a file named TestColor.java: import java.applet.Applet; import java.awt.*;

public class TestColor extends Applet {        public void init {           List l = new List; add(l); l.addItem( "1" ); l.addItem( "2" ); l.addItem( "3" ); l.setBackground(Color.blue); l.setForeground(Color.yellow);

Choice c = new Choice; add( c ); c.addItem( "1" ); c.addItem( "2" ); c.addItem( "3" ); c.setBackground(Color.blue);

Scrollbar sb = new Scrollbar(Scrollbar.VERTICAL); add( sb); sb.setBackground(Color.blue); }     }                     Compile the file. Run the applet in Internet Explorer 4.0x. The Choice control paints the specified background color, blue, in the button that drops down the choices. The expected system color for buttons is gray in the default Window desktop theme. The Foreground color of the List control does not change to yellow.

In addition, the Scrollbar's arrows and thumb change to the new background color, blue, instead of the expected system color for buttons (gray in the default Window desktop theme).

This bug will appear in builds of the Virtual Machine for Java prior to the distribution vehicles listed above.

Additional query words: color choice list background kbDSupport

Keywords: kbbug kbfix KB188448

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.