|
-
August 3rd, 1999, 10:31 AM
#1
Drawing String
Hi,
Now i am with a new problem. I am drawing a string in a container using g.drawString(String,0,0);
Now i want to add a underline to the string in the container. How is it possible
Thanks in advance
-
August 3rd, 1999, 09:48 PM
#2
Re: Drawing String
Try something like
import java.applet.*;
import java.awt.*;
public class underlineText extends Applet{
String s = "Underlined text";
int x=0;
int y=0;
public void init() {}
public void paint(Graphics g) {
g.drawString(s, x,y);
g.drawLine(x , y+2 , x+getFontMetrics(getFont()).stringWidth(s) , y+2 );
}
}
---
Real Gagnon
Java Javascript and PowerBuilder How-to
http://www.tactika.com/realhome
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|