Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 underlining text in java
Index -> Programming, Java -> Java Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
kunal445




PostPosted: 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"
Sponsor
Sponsor
Sponsor
sponsor
Amarylis




PostPosted: 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?
kunal445




PostPosted: 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.
DemonWasp




PostPosted: 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.
QuantumPhysics




PostPosted: 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
Display posts from previous:   
   Index -> Programming, Java -> Java Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 5 Posts ]
Jump to:   


Style:  
Search: