Microsoft Visual J++. Java


TextOut - 5


fm = g.getFontMetrics();

yCurrent += fm.getHeight();

 

//

if(m_Type2.equals("Bold"))

g.setFont(new Font(m_Font3, Font.BOLD, 25));

 

else if(m_Type2.equals("Italic"))

g.setFont(new Font(m_Font3, Font.ITALIC, 25));

 

else if(m_Type2.equals("Plain"))

g.setFont(new Font(m_Font3, Font.PLAIN, 25));

 

//

g.drawString(m_Str3, 10, yCurrent);

 

//

//

fm = g.getFontMetrics();

yCurrent += fm.getHeight();

 

//

if(m_Type2.equals("Bold"))

g.setFont(new Font(m_Font4, Font.BOLD, 25));

 

else if(m_Type2.equals("Italic"))

g.setFont(new Font(m_Font4, Font.ITALIC, 25));

 

else if(m_Type2.equals("Plain"))

g.setFont(new Font(m_Font4, Font.PLAIN, 25));

 

//

g.drawString(m_Str4, 10, yCurrent);

 

//

//

fm = g.getFontMetrics();

yCurrent += fm.getHeight();

 

//

if(m_Type3.equals("Bold"))

g.setFont(new Font(m_Font5, Font.BOLD, 25));

 

else if(m_Type3.equals("Italic"))

g.setFont(new Font(m_Font5, Font.ITALIC, 25));

 

else if(m_Type3.equals("Plain"))

g.setFont(new Font(m_Font5, Font.PLAIN, 25));

 

//

g.drawString(m_Str5, 10, yCurrent);

}

}

HTML, TextOut, 3.6.

3.6. TextOut\TextOut.html

<html>

<head>

<title>TextOut</title>

</head>

<body>

<hr>

<applet

code=TextOut.class

id=TextOut

width=320

height=240 >

<param name=Str1 value="Hello 1">

<param name=Str2 value="Hello 2">

<param name=Str3 value="Hello 3">

<param name=Str4 value="Hello 4">

<param name=Str5 value="Hello 5">

<param name=Font1 value="Dialog">

<param name=Font2 value="Courier">

<param name=Font3 value="TimesRoman">

<param name=Font4 value="Helvetica">

<param name=Font5 value="Undefined">

<param name=Type1 value="Bold">

<param name=Type2 value="Italic">

<param name=Type3 value="Plain">

</applet>

<hr>

<a href="TextOut.java">The source.</a>

</body>

</html>