Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4071232

Text disappears after a drawImage(AffineTransform)

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 1.2.0
    • 1.2.0
    • client-libs
    • None
    • 2d
    • 1.2beta
    • 1.2beta
    • sparc
    • solaris_2.5.1
    • Verified

      I'm expecting the text from the drawString call to stay painted on the canvas. The text appears for a second, but it is cleared once the image is drawn. The text reappears after the window is refreshed.

      import java.awt.*;
      import java.awt.geom.AffineTransform;
      import java.awt.font.StyledString;

      public class shear extends Canvas
      {
          Image img1;

          public shear()
          {
              setBackground(Color.white);

              img1 = getToolkit().getImage("image3.gif");
          }

          public void paint(Graphics g)
          {
              Graphics2D g2 = (Graphics2D) g;

              g.drawString("400,100", 400, 100);

              AffineTransform at = new AffineTransform(1,0,.2,1,0,0);
              at.translate( 100, 100);
              g2.drawImage(img1, at, this);
         }

          public static void main(String s[])
          {
              Frame f = new Frame("Java 2D Test Product");
              f.setSize(new Dimension(800,600));
              f.add("Center", new shear());
              f.pack();
              f.show();
          }
      }

            flar Jim Graham
            blichtensunw Brian Lichtenwalter (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: