-
Bug
-
Resolution: Fixed
-
P3
-
1.4.0
-
mantis
-
x86
-
windows_2000
Name: gm110360 Date: 05/01/2002
FULL PRODUCT VERSION :
FAILS:
Java Plug-in (under IE 5.50 )
> java version "1.4.0"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-b92)
> Java HotSpot(TM) Client VM (build 1.4.0-b92, mixed mode)
WORKS:
Java Plug-in (under IE 5.50 )
> java version "1.3.1"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1-b24)
> Java HotSpot(TM) Client VM (build 1.3.1-b24, mixed mode)
FULL OPERATING SYSTEM VERSION :
Microsoft Windows 2000 [Version 5.00.2195]
ADDITIONAL OPERATING SYSTEMS :
Windows NT 4.0
EXTRA RELEVANT SYSTEM CONFIGURATION :
Appears on varying combinations of video hardware, across
Windows 2000/NT4 (others untested). Fails consistantly on
these video cards: Matrox Millenium 200, ATI Rage Pro.
Fails intermittently on: ATI Radeon DDR 32 M.
A DESCRIPTION OF THE PROBLEM :
A class extending JButton overrides the paint( Graphics g )
method. It properly calls the superconstructor, then makes
graphics calls to draw additional features to the button.
Under the latest 1.4 release, the button always takes on a
default appearance, despite the added calls in paint().
REGRESSION. Last worked in version 1.3.1
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Override JButton (see source example)
2. Add to a JPanel with null layout manager, position
manually.
3. Display JPanel as part of a JApplet, view in the Plug-
in, inside MSIE.
EXPECTED VERSUS ACTUAL BEHAVIOR :
The expected result is that graphics calls made on the
Graphics object passed into the paint method would be drawn
to screen, as in previous versions of java. Though the
calls are clearly made (because debug that is in-line with
the draw() calls is always printed), there is no on-screen
representation that they ever occurred.
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
<---- START SOURCE FOR OVERRIDDEN JButton WIDGET ---->
import java.awt.*;
import javax.swing.*;
public class JButtonWithArrow extends JButton {
public JButtonWithArrow() {
super();
} // of constructor
public JButtonWithArrow( String s ) {
super( s );
} // of constructor
public JButtonWithArrow( String s, Icon i ) {
super( s, i );
} // of constructor
public void paint( Graphics g ) {
super.paint(g);
int width = this.getBounds().width;
int height = this.getBounds().height;
int verticalCenter = height/2;
Graphics2D g2d = (Graphics2D)(g);
g2d.setPaint( Color.black );
int[] arrowPointsX = new int[25];
int[] arrowPointsY = new int[25];
int i=0;
for( i=0; i<=8; i++ ) {
arrowPointsX[i] = width-(14-i);
arrowPointsY[i] = verticalCenter-2;
} // of for
for( i=9; i<=15; i++ ) {
arrowPointsX[i] = width-((14+8)-i);
arrowPointsY[i] = verticalCenter-1;
} // of for
for( i=16; i<=20; i++ ) {
arrowPointsX[i] = width-((21+7)-i);
arrowPointsY[i] = verticalCenter;
} // of for
for( i=21; i<=23; i++ ) {
arrowPointsX[i] = width-((26+6)-i);
arrowPointsY[i] = verticalCenter+1;
} // of for
for( i=24; i<=24; i++ ) {
arrowPointsX[i] = width-((29+5)-i);
arrowPointsY[i] = verticalCenter+2;
} // of for
for( i=0; i<arrowPointsX.length; i++ ) {
g2d.draw( new Rectangle( arrowPointsX[i], arrowPointsY[i], 0, 0 ) );
System.out.println( "drawing at [" +
arrowPointsX[i] +
"," +
arrowPointsY[i] +
"]" );
} // of for
} // of paint()
} // of class JButtonWithArrow
<---- END ---->
<---- START SOURCE FOR SIMPLE JApplet TO DEMONSTRATE ---->
import javax.swing.*;
import java.awt.*;
public class TestApplet extends JApplet {
private int appletW;
private int appletH;
private JPanel blackPanel;
protected JButtonWithArrow b1,
b2,
b3,
b4;
public void init() {
appletW = this.getBounds().width;
appletH = this.getBounds().height;
blackPanel = new JPanel();
blackPanel.setLayout( null );
blackPanel.setBounds( 5, 5, appletW-10, appletH-10 );
blackPanel.setBackground( Color.black );
this.getContentPane().setLayout( null );
this.getContentPane().add( blackPanel );
b1 = new JButtonWithArrow();
b1.setBounds( 5, 5, 50, 25 );
b2 = new JButtonWithArrow();
b2.setBounds( 5, 35, 100, 25 );
b3 = new JButtonWithArrow();
b3.setBounds( 5, 65, 50, 40 );
b4 = new JButtonWithArrow();
b4.setBounds( 5, 110, 100, 40 );
blackPanel.add( b1 );
blackPanel.add( b2 );
blackPanel.add( b3 );
blackPanel.add( b4 );
} // of init()
} // of class TestApplet
<---- END ---->
---------- END SOURCE ----------
CUSTOMER WORKAROUND :
Use JRE/JSDK 1.3.1 Plug-In
Release Regression From : 1.3.1_03
The above release value was the last known release where this
bug was known to work. Since then there has been a regression.
(Review ID: 143158)
======================================================================
- relates to
-
JDK-4770290 JCK1.4a-runtime api/java_awt/interactive/ComponentTests.html#ComponentTests fail
- Closed
-
JDK-4771101 REGRESSION: Regtest sun/java2d/SunGraphics2D/PolyVertTest.java failed
- Closed