Computer Science Canada

underlining text in java

Author:  kunal445 [ Wed May 09, 2012 8:48 pm ]
Post subject:  underlining text in java

our teacher told us to use java applet to create the following program.
Q2.) Write a program that prints your school name as follows, using a loop, the name in red, the underline in blue.

at our school we use net beans and ready to program
---
//The "HelloAgainApplet" class.
import javax.swing.*;
import java.awt.*;
public class HelloAgainApplet extends JApplet {
Font f = new Font("Times Roman", Font.BOLD, 36);
public void paint (Graphics g)
{
g.setFont(f);
g.setColor( Color .red);
g.drawString("Applewood heights S.S",5,40);
} // paint method
} // HelloAgainApplet class

---
what do i do to make it underline "Applewood heights S.S"

Author:  Amarylis [ Wed May 09, 2012 8:52 pm ]
Post subject:  RE:underlining text in java

Have you tried using the "_" character, and same starting coordinates as the rest of your text?

Author:  kunal445 [ Wed May 09, 2012 9:41 pm ]
Post subject:  Re: underlining text in java

well no and i can always draw a line there in that color but i don't think that how our teacher wants us to do it. i believe he wants us to set up the font so that it would be already underlined.

Author:  DemonWasp [ Wed May 09, 2012 11:23 pm ]
Post subject:  RE:underlining text in java

Draw the text in blue, with underline enabled.
Draw the text again in red, with underline disabled.

Author:  QuantumPhysics [ Tue May 29, 2012 11:22 am ]
Post subject:  RE:underlining text in java

use the console functions for the public namestat that should give you access to draw polygons. get the user to input the desired coords as you would define them with a constant and let the user input it


: