-
Bug
-
Resolution: Fixed
-
P3
-
1.2.0
-
None
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();
}
}
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();
}
}