Java Reference
In-Depth Information
g.setColor(currentColor);
g.setFont( new Font(currentFontName,
intBold + intItalic, 24));
g.drawString("Welcome to Java Programming", 30, 30);
}
public void itemStateChanged(ItemEvent e)
{
if (e.getSource() == boldCB)
{
if (e.getStateChange() == ItemEvent.SELECTED)
intBold = Font.BOLD;
if (e.getStateChange() == ItemEvent.DESELECTED)
intBold = Font.PLAIN;
}
if (e.getSource() == italicCB)
{
if (e.getStateChange() == ItemEvent.SELECTED)
intItalic = Font.ITALIC;
if (e.getStateChange() == ItemEvent.DESELECTED)
intItalic = Font.PLAIN;
}
if (e.getSource() == redRB)
currentColor = Color.red;
else if (e.getSource() == greenRB)
currentColor = Color.green;
else if (e.getSource() == blueRB)
currentColor = Color.blue;
if (e.getSource() == fontFaceDD)
currentFontName =
fontNames[fontFaceDD.getSelectedIndex()];
repaint();
}
}
The HTML file for this program contains the following code:
<HTML>
<HEAD>
<TITLE>WELCOME</TITLE>
</HEAD>
<BODY>
<OBJECT code = "GrandWelcomeFinal.class" width = "440"
height = "200">
</OBJECT>
</BODY>
</HTML>
Search WWH ::




Custom Search