
Hi, how can i write a simple java applet, displaying text in specific colors and font style.
For example, the output will be something like : Name in red color Age in blue color Nationality in green color
Help me pls :(

Hi Friend,
Try the following code:
import java.awt.*;
import java.applet.*;
public class ShowsTextExample extends Applet{
public void paint(Graphics g){
g.setColor(Color.black);
g.drawString("Name:",10,10);
g.setFont(new Font("Monotype Corsiva",Font.BOLD,20));
g.setColor(Color.red);
g.setFont(new Font("Monotype Corsiva",Font.BOLD,20));
g.drawString("Rose",100,10);
g.setColor(Color.black);
g.drawString("Age:",10,40);
g.setFont(new Font("Monotype Corsiva",Font.BOLD,20));
g.setColor(Color.blue);
g.setFont(new Font("Monotype Corsiva",Font.BOLD,20));
g.drawString("20",100,40);
g.setColor(Color.black);
g.drawString("Nationality:",10,70);
g.setFont(new Font("Monotype Corsiva",Font.BOLD,20));
g.setColor(Color.green);
g.setFont(new Font("Monotype Corsiva",Font.BOLD,20));
g.drawString("20",100,70);
}
}
Thanks

thank you for the code...its really work :)
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.