Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.

Tip of the Day
Language: Java
Expertise: Intermediate
May 21, 2001



Application Security Testing: An Integral Part of DevOps

How to Write Underlined Text

Interestingly, underline is not a supported font style, i.e., you cannot say Font.UNDERLINE to draw an underlined text.

The trick is to use Graphics.drawLine() method to draw a line just below the text. Take a look at the following program:
// UnderlineTextDemo.java

import java.awt.*;

/** Demonstrates how to draw underlined text. */
public class UnderlineTextDemo extends Frame {

  /** The demo text. */
  public static String DEMO_TEXT = 
Shantanu Garg
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date