JDK-4226498 : JProgressBar has no method to set String color
  • Type: Enhancement
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 1.2.0
  • Priority: P4
  • Status: Closed
  • Resolution: Won't Fix
  • OS: generic
  • CPU: generic
  • Submitted: 1999-04-02
  • Updated: 1999-06-28
  • Resolved: 1999-06-28
Related Reports
Relates :  
Description

Name: vi73552			Date: 04/02/99


There is no way for me to set the String color for a
JProgressBar.  setForeground() sets Color of the actual
progress, but not the text.  Calling setBackground()
or setOpaque(false) doesn't seem to affect the text
color.

For the default L&F on Solaris, at least, the text winds
up being some light shade of slate gray.  If either the
foreground or background color doesn't contrast well with
this color, the text cannot be read.
(Review ID: 56448) 
======================================================================

Comments
WORK AROUND Name: vi73552 Date: 04/02/99 Choose background/foreground colors that work well with gray, regardless of how it looks with the rest of your UI? ======================================================================
11-06-2004

PUBLIC COMMENTS It is true that there is no API for setting these colors. However, these colors can be set using the Defaults Table utilizing the key "ProgressBar.selectionBackground" and "ProgressBar.selectionForeground". Defining these key/value pairs before creating a JProgressBar will have the desired affect. I am therefore reluctant to add new API. Example: UIManager.put("ProgressBar.selectionBackground", Color.green); UIManager.put("ProgressBar.selectionForeground", Color.black); Although I cannot reccommend these color choices. On another front, I could see the case where you'd want the colors of the String to track the foreground/background colors of the ProgressBar. I'm still reluctant to allow arbitrary color changes to ONLY the String without coordinating the overall aesthetic of the ProgressBar. michael.albers@Eng 1999-06-28
28-06-1999

EVALUATION It is true that there is no API for setting these colors. However, these colors can be set using the Defaults Table utilizing the key "ProgressBar.selectionBackground" and "ProgressBar.selectionForeground". I am therefore reluctant to add new API. michael.albers@Eng 1999-06-28
28-06-1999