
-----------------------------------
kunal445
Wed May 09, 2012 8:48 pm

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"

-----------------------------------
Amarylis
Wed May 09, 2012 8:52 pm

RE:underlining text in java
-----------------------------------
Have you tried using the "_" character, and same starting coordinates as the rest of your text?

-----------------------------------
kunal445
Wed May 09, 2012 9:41 pm

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.

-----------------------------------
DemonWasp
Wed May 09, 2012 11:23 pm

RE:underlining text in java
-----------------------------------
Draw the text in blue, with underline enabled.
Draw the text again in red, with underline disabled.

-----------------------------------
QuantumPhysics
Tue May 29, 2012 11:22 am

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
