Java Reference
In-Depth Information
Your output window should contain these lines:
C:>javac ErrorMsg.java
C:>javac HelloWorld.java
C:>java HelloWorld
Hello World!
Some Text
Some New Text
Some Text for #2
Some New Text
SOME NEW TEXT
C:\java4cobol>
You will now modify the applet version of your HelloWorld class so that it also
uses the ErrorMsg class.
1. Using the text editor, edit the HelloWorld.java file in your java4cobol\
applet directory.
2. Add the required source text to your HelloWorld applet class so that it looks
like this:
import java.applet.Applet;
import java.awt.Graphics;
public class HelloWorld extends Applet
{
public void paint(Graphics g)
{
String tempMsg;
g.drawString("Hello applet World!", 5, 25);
// Create a new instance of the ErrorMsg class.
ErrorMsg myErrorMsg = new ErrorMsg ();
// Print the contents of the public data member msgText in our class.
tempMsg = myErrorMsg.getErrorMsg ();
g.drawString (tempMsg, 5, 35);
Search WWH ::




Custom Search