Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 4316828
Votes 3
Synopsis Images drawn at wrong location when partially covered by another window
Category java:classes_2d
Reported Against 1.2.2
Release Fixed 1.4(merlin)
State 10-Fix Delivered, bug
Priority: 4-Low
Related Bugs 4632146
Submit Date 27-FEB-2000
Description




27 Feb 2000,   xxxxx@xxxxx   -- as of kestrel build "U" on Solaris, this bug is not reproducible.  However, as of build "T" on NT 4.0, the problem is reproducible if you
block the image "from above" -- meaning, you move the "cover" frame completely over the image from the top, cover the image's full width for some percentage of
its height.  The image (as shown under 1.2.2) shifts veritically down, to draw "under" the cover.  That is, it moves its (x, 0) position down to the (x, ymax) position
of the cover box.  Am filing a reference bug, just to make sure this fix is definitely in the newer kestrel win32 build.  

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

[setting your PATH to include the JDK's "bin" subdir will work around this error below]
Registry key 'Software\JavaSoft\Java Runtime Environment\CurrentVersion'
	has value '1.2', but '1.3' is required.
	Error: could not find java.dll
	Error: could not find Java 2 Runtime Environment.


Graphics.drawImage() draws images at the wrong position when
the repaint area is covered completely in one dimension (say vertical)
and partially in another (say horizontal) by another window.

I have tried virtually every Graphics/Graphics2D.drawImage()
method, and this bug appears with each of them.

1. Run the application class PaintingBug below.

This app creates two frames, an Image frame and a Cover frame.
An image will be continuously repainting in the Image frame.
 
2. Drag the Cover frame downward over the repainting image in the
Image frame, so that the repainting image is covered completely in the
horizontal direction, but progressively (as you drag down) in the vertical
direction.
 
The image will draw incorrectly as you do this.  Instead of remaining
at its proper location the image will get pushed downward, although the
bottom will be clipped by the clip region.

3. Now drag the Cover frame downward over the repainting image so
that it does not completely cover the left (or right) side of the image.

The bug will not occur this time.

4. Repeat steps 2 and 3 by dragging left-to-right insead of downward.
The same results will occur.

--------------------

import java.awt.*;
import java.awt.event.*;
import java.awt.image.*;

public class PaintingBug
  {
  // ================================== Properties

  // image - to be repeatedly painted in image frame
  static BufferedImage image;
  
  // imageFrame - continuously repaints an image
  static Frame imageFrame = new Frame()
    {
    public void paint(Graphics g)
      {
      ((Graphics2D) g).drawImage(image,null,100,100);
      repaint(100,100,50,50);
      }
    };

  // coverFrame - to be dragged over image frame to reveal bug
  static Frame coverFrame = new Frame();
  
  // applicationQuitter - performs exit when either window is closed
  static WindowListener applicationQuitter = new WindowAdapter()
    {
    public void windowClosing(WindowEvent e)
      { System.exit(0); }
    };
  
  // ================================== Main
  
  static public void main(String[] args)
	{
    // Create Image
    image = new BufferedImage(50,50,BufferedImage.TYPE_INT_ARGB);
    Graphics2D imageGraphics = (Graphics2D) image.getGraphics();
    imageGraphics.setColor(Color.darkGray);
    imageGraphics.fill(new Rectangle(0,0,50,50));
    imageGraphics.setColor(Color.red);
    imageGraphics.fill(new Rectangle(5,5,40,5));
    imageGraphics.setColor(Color.green);
    imageGraphics.fill(new Rectangle(5,40,40,4));
    imageGraphics.setColor(Color.blue);
    imageGraphics.fill(new Rectangle(5,10,5,30));
    imageGraphics.setColor(Color.yellow);
    imageGraphics.fill(new Rectangle(40,10,5,30));

    // Create Image Frame
	imageFrame.setTitle("Repainting Image");
	imageFrame.setBounds(100,250,250,250);
	imageFrame.addWindowListener(applicationQuitter);
	imageFrame.setVisible(true);
	
	// Create Cover Frame
	coverFrame.setTitle("Cover");
	coverFrame.setBounds(150,50,150,150);
	coverFrame.addWindowListener(applicationQuitter);
	coverFrame.setVisible(true);
    }
  }

-------------
(Review ID: 101755) 
======================================================================
Work Around
N/A
Evaluation
Commit to fix in Merlin.  
  xxxxx@xxxxx   2000-02-28

This is working in the merlin workspace.  It was working before Feb 9 so
it must have been fixed by the work on the new architecture.
  xxxxx@xxxxx   2000-03-17

This is fixed in the merlin beta release (1.4 beta).  
  xxxxx@xxxxx   2001-08-14
Comments
  
  Include a link with my name & email   

Submitted On 14-MAR-2000
markbeale
I CANNOT ship my product until this is fixed.
It is a huge problem for me.


Submitted On 20-MAY-2000
markbeale
I have verified that this bug still exists in 1.3.0


Submitted On 15-DEC-2000
markbeale
This bug still occurs in JVM 1.3 on Win2K.  I CANNOT ship 
my product until it is fixed in a shipping version of the 
JVM.  Please get this bug fix out!


Submitted On 18-FEB-2001
Rammensee
Bug still appears on 1.3 WinNT. So why is it closed ?
We need a fix for this bug ! 


Submitted On 13-AUG-2001
mmanzel
This bug still exist in version 1.3.1 on WinNT! 
So why is it closed? You should fix the error before closing
it!


Submitted On 14-DEC-2001
belkoV
I've just checked under jdk1.4.0-beta3-b84 
(this version is available at java.sun.com) - 
bug is fixed.

It was not fixed in jdk1.3 - just in recent version of jdk.



PLEASE NOTE: JDK6 is formerly known as Project Mustang