-
Bug
-
Resolution: Fixed
-
P2
-
7
-
b64
-
generic
-
generic
-
Verified
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2184377 | OpenJDK6 | Peter Zhelezniakov | P3 | Resolved | Fixed | b18 |
The spec for javax.swing.plaf.nimbus.NimbusLookAndFeel.getDerivedColor(Color color1, Color color2, float midPoint) says:
* @param midPoint The offset between color 1 and color 2, a value of 0.0 is
* color 1 and 1.0 is color 2;
Exact second color is not always returned for 1.0 offset value.
Please see the following code sample:
------------------------------------------------------------------------------------
import java.awt.*;
public class Test {
public static void main(String[] args) {
class MyNibusLAF extends javax.swing.plaf.nimbus.NimbusLookAndFeel {
public Color callGetDerivedColor(Color c1, Color c2, float midPoint) {
return getDerivedColor(c1, c2, midPoint);
}
}
Color secondColor = Color.BLACK;
Color returnedColor = new MyNibusLAF().callGetDerivedColor(Color.WHITE, secondColor, 1.f);
System.out.println("returnedColor = " + returnedColor);
System.out.println("secondColor = " + secondColor);
}
}
------------------------------------------------------------------------------------
Output will look:
returnedColor = javax.swing.plaf.ColorUIResource[r=1,g=1,b=1]
secondColor = java.awt.Color[r=0,g=0,b=0]
Color RGB components are not as expected.
* @param midPoint The offset between color 1 and color 2, a value of 0.0 is
* color 1 and 1.0 is color 2;
Exact second color is not always returned for 1.0 offset value.
Please see the following code sample:
------------------------------------------------------------------------------------
import java.awt.*;
public class Test {
public static void main(String[] args) {
class MyNibusLAF extends javax.swing.plaf.nimbus.NimbusLookAndFeel {
public Color callGetDerivedColor(Color c1, Color c2, float midPoint) {
return getDerivedColor(c1, c2, midPoint);
}
}
Color secondColor = Color.BLACK;
Color returnedColor = new MyNibusLAF().callGetDerivedColor(Color.WHITE, secondColor, 1.f);
System.out.println("returnedColor = " + returnedColor);
System.out.println("secondColor = " + secondColor);
}
}
------------------------------------------------------------------------------------
Output will look:
returnedColor = javax.swing.plaf.ColorUIResource[r=1,g=1,b=1]
secondColor = java.awt.Color[r=0,g=0,b=0]
Color RGB components are not as expected.
- backported by
-
JDK-2184377 Nimbus L&F: NimbusLookAndFeel.getDerivedColor() not always returns color2 for 1.0 midPoint
- Resolved
- duplicates
-
JDK-6849396 Nimbus L&F:AbstractRegionPainter.decodeColor(Col,Col,f) not always return color2 if midPoint is 1.f
- Closed