United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-4664885 JCK1.4,interactive: api/javax_swing/interactive/BorderFactoryTests.html#BorderFa
JDK-4664885 : JCK1.4,interactive: api/javax_swing/interactive/BorderFactoryTests.html#BorderFa

Details
Type:
Bug
Submit Date:
2002-04-09
Status:
Closed
Updated Date:
2003-10-14
Project Name:
JDK
Resolved Date:
2003-09-05
Component:
client-libs
OS:
linux,generic,windows_2000
Sub-Component:
javax.swing
CPU:
x86,sparc,generic
Priority:
P3
Resolution:
Fixed
Affected Versions:
1.4.0,1.4.1,1.4.2
Fixed Versions:
5.0 (tiger)

Related Reports
Duplicate:
Duplicate:

Sub Tasks

Description
See 4668513 for a clear description of the problem. The fix to this bug should be a doc change.
###@###.### 2003-01-27


Original description:
---------------------

Name: asR10013			Date: 04/08/2002


Filed By       : J2SE-SQA [###@###.###
JDK            : jdk1.4.1-b07
JCK            : jck1.4-b17
Platform[s]    : Windows 2000 pro
switch/Mode    : -client -Xmixed -Xfuture
JCK test owner : http://javaweb.eng/jck/usr/owners.jto
Falling test[s]:
api/javax_swing/interactive/BorderFactoryTests.html#BorderFactory
[BorderFactoryTest0003]
 
Shadow borders created with BorderFactory.createBevelBorder(raisedInt,
Color.WHITE, Color.BLACK, Color.red, Color.blue)
interchange their shadowInner and shadowOuter colors depending whether
they are raised or not. 
 
Test source location:
=====================
/net/jdk/export/disk8/local.java/jck1.4/JCK-runtime-14/tests/api/javax_swing/BorderFactoryTests.java
 
jtr file location:
==================
/net/jtgb4u4c.eng/export/sail15/results/hopper/b07/jck14/win32/win2000_client_linux-2/workDir/api/javax_swing/BorderFactoryTests_BorderFactory.jtr

How to reproduce:
=================
Run the following script (you may need to change JCK and JDK variables)
 
The test window appears and you are provided with instructions to
complete the test.
Notice that 
when the "Raised" checkbox is checked then 
   shadowInner=blue and shadowOuter=red 
while when the "Raised" checkbox is NOT checked 
then
   shadowInner=red and shadowOuter=blue. 

highlightInner and highlightOuter are treated correctly.

--- script start ---
#!/bin/sh

# change variables as needed

JCK="c:/jck1.4/JCK-runtime-14"
JDK="c:/jdk1.4.1"
switches="-client -Xmixed -Xfuture"
CLASSPATH="${JCK}/classes:${JCK}/javatest.jar"

$JDK/bin/java $switches -cp $CLASSPATH javasoft.sqe.tests.api.javax.swing.interactive.BorderFactory.BorderFactoryTests
-TestCaseID BorderFactoryTest0003 -TestDirURL file:///${JCK}/tests/api/javax_swing/interactive/BorderFactoryTests.html#BorderFactory 
 
--- script end ---

Test output:
============

BorderFactoryTest0003: Failed.
BorderFactorycreateBevelBorder(type,highlightOuter,highlightInner,shadowOuter,shadowInner)
does not work as expected.

STATUS:Failed.tests: 1; failed: 1; first test case failure:
BorderFactoryTest0003


Specific Machine Info:
======================
Hostname: linux-2
OS: Windows 2000 pro



======================================================================

                                    

Comments
PUBLIC COMMENTS

.
                                     
2004-06-10
SUGGESTED FIX



Name: asR10013			Date: 04/08/2002



The problem seems to be caused by the following mistake in the source
code of the BevelBorder class:

protected void paintLoweredBevel(Component c, Graphics g, int x, int y,
                                        int width, int height)  {
        Color oldColor = g.getColor();
        int h = height;
        int w = width;
 
        g.translate(x, y);
 

// the following section =>
        g.setColor(getShadowInnerColor(c));
//   VSH: these are the topmost and the leftmost lines, 
//   but they are drawn with the inner color 
        g.drawLine(0, 0, 0, h-1);                   
        g.drawLine(1, 0, w-1, 0);
 
        g.setColor(getShadowOuterColor(c));
        g.drawLine(1, 1, 1, h-2);
        g.drawLine(2, 1, w-2, 1);
// <= should look like this =>
/* 
       g.setColor(getShadowOuterColor(c));
        g.drawLine(0, 0, 0, h-1);                 
        g.drawLine(1, 0, w-1, 0);
 
        g.setColor(getShadowInnerColor(c));
        g.drawLine(1, 1, 1, h-2);
        g.drawLine(2, 1, w-2, 1);
*/
// <=
        g.setColor(getHighlightOuterColor(c));
        g.drawLine(1, h-1, w-1, h-1);
        g.drawLine(w-1, 1, w-1, h-2);
 
        g.setColor(getHighlightInnerColor(c));
        g.drawLine(2, h-2, w-2, h-2);
        g.drawLine(w-2, 2, w-2, h-3);
 
        g.translate(-x, -y);
        g.setColor(oldColor);
 
    }


I have applied these changes to rt.jar of my JDK 1.4.1 installation. 
The bug has disappeared.

======================================================================
                                     
2004-06-11
CONVERTED DATA

BugTraq+ Release Management Values

COMMIT TO FIX:
tiger

FIXED IN:
tiger

INTEGRATED IN:
tiger
tiger-b19

VERIFIED IN:
tiger-beta


                                     
2004-06-14
EVALUATION

Will be fixed for hopper.
###@###.### 2002-04-10

We should update javadoc as appropriate.
###@###.### 2002-04-29

Exclusion has been granted for this, will fix for tiger.
###@###.### 2002-05-06

For a lowered bevel border, the inner and outer shadow colors appear switched. I've done much testing and determined that this is what is wanted - it is how the colors should be treated for the best visual results. However, it means the documentation is misleading. We should add documentation stating how the colors may be switched depending on the effect. Changes will be made to both BevelBorder.java and BorderFactory.java (for the createBeveledBorder method).

Note that this is not a regression. Behavior has been this way for a long time.

Also, ###@###.### owns a bug that is a duplicate of this one (4668513). Will close that one as a duplicate and re-assign this one to her.
###@###.### 2003-01-27

Shannon reviewed the changes.  Approved by CCC.  Fixed for tiger.
###@###.### 2003-08-29
                                     
2003-01-27



Hardware and Software, Engineered to Work Together