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

Text disappears after a drawImage(AffineTransform)

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 1.2.0
    • Fix Version/s: 1.2.0
    • Component/s: client-libs
    • Labels:
      None
    • Subcomponent:
      2d
    • Introduced In Build:
      1.2beta
    • Introduced In Version:
    • Resolved In Build:
      1.2beta
    • CPU:
      sparc
    • OS:
      solaris_2.5.1
    • Verification:
      Verified

      Description

      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();
          }
      }

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: