K
Kevin
Hello All,
It supposed to be a simple problem but I just can't get it working:
The Mission:
to draw a text vertically on a JPanel.
The Code:
// in paintComponent or any other places such as in response to a mouse
click.
Graphics2D g2d = (Graphics2D) g;
AffineTransform at = new AffineTransform();
at.setToRotation(-Math.PI/2.0);
g2d.setTransform(at);
g2d.drawString("tttttt", 10, 10);
////
:-( it does NOT work. No text is drawn.
I tried and if I remove the line g2d.setTransform(at), then the text
will be drawn as expected (non vertical). But if I add the
setTransform, nothing shows up.
Also, I have tried the rotate functions, still not work.
Any one know any possible reasons?
Thanks a lot.
PS: my code is taken from
http://javaalmanac.com/egs/java.awt/RotateText.html
It supposed to be a simple problem but I just can't get it working:
The Mission:
to draw a text vertically on a JPanel.
The Code:
// in paintComponent or any other places such as in response to a mouse
click.
Graphics2D g2d = (Graphics2D) g;
AffineTransform at = new AffineTransform();
at.setToRotation(-Math.PI/2.0);
g2d.setTransform(at);
g2d.drawString("tttttt", 10, 10);
////
:-( it does NOT work. No text is drawn.
I tried and if I remove the line g2d.setTransform(at), then the text
will be drawn as expected (non vertical). But if I add the
setTransform, nothing shows up.
Also, I have tried the rotate functions, still not work.
Any one know any possible reasons?
Thanks a lot.
PS: my code is taken from
http://javaalmanac.com/egs/java.awt/RotateText.html