Hi,
Jorge,
Just a
quick stab at the problem:
in
Graphics.drawString( String string , int x, int y ), y is the baseline of the
text. You need to increase y by the height of your font.
Raffi
-----Original Message-----
From: Jorge Guerra [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 08, 2002 1:52 PM
To: [EMAIL PROTECTED]
Subject: [JAVA3D] Raster objects problemshere's a picture of what I'm trying to do... I want to have the flat little boxes by the geometry entities display numbers. I'm trying to use Raster obects to accomplish this however I can't seem to understand the way in which I can draw to these Rasters.... There's a connection with drawing Images of things like Strings, in this case. If anyone can help me I'd be very greatful. I'm also putting the section of code that does the work here.
BufferedImage bi = new BufferedImage(25, 20, BufferedImage.TYPE_INT_RGB);
Graphics2D big = bi.createGraphics();
big.setFont(new Font("Arial", Font.PLAIN, 8));
big.setColor(Color.white);
big.drawString(String.valueOf(entityNumber+1), 0, 0);
big.drawImage(bi, new java.awt.geom.AffineTransform(), new javax.swing.JPanel());
javax.media.j3d.Raster numberImage = new javax.media.j3d.Raster(new Point3f((float)placement.x, (float)placement.y, (float)placement.z), javax.media.j3d.Raster.RASTER_COLOR, 0, 0, 25, 20, new ImageComponent2D(ImageComponent.FORMAT_RGB, bi), null);
Shape3D textObject = new Shape3D(numberImage);
Chat with friends online, try MSN Messenger: Click Here
