Computer Science, asked by tvaijapurkar, 11 months ago

write a java program to display the text i like Java. use the Times New Roman font name the italic font style and the 15 font size

Answers

Answered by ridhimakh1219
2

write a java program to display the text i like Java. use the Times New Roman font name the italic font style and the 15 font size

Explanation:

Write a program to display the text "i like Java" using font "Times New Roman", style as ITALIC and size as 15 and the string is passed as parameter.

import java.awt.*;

import java.applet.*;

/*

<applet code="Example" width = "200" height = "200">

<param name="str" value="I like Java">

</applet>

*/

public class Example extends Applet

{

String msg;

public void init()

{

 msg = this.getParameter("str");

 setFont(new Font("Times New Roman", Font.ITALIC, 15));

}

public void paint(Graphics g)

{

 g.drawString(msg, 50, 100);

}

}

Similar questions