PDA

View Full Version : Simple Java App


Jon W
12-01-2008, 05:39 PM
I'm doing something wrong here, and I'm not to sure what I'm doing wrong. I'm obviusly new to Java, and just trying to get a hang of it.



import java.awt.*; import java.applet.*;

public class NewApp extends Applet {

public void init()
{

Color mySytle=new Color(666);
setBackground(myStyle);
resize(150, 50);

}

public void paint(Graphics g) {

g.drawString("This is my string. Hello everyone!", 50, 20);
}

}

icm9768
12-03-2008, 01:55 AM
When I run this, it seems to work fine although I did have to fix a typo in the code you posted:

Color mySytle=new Color(666);

I changed mySytle to myStyle.

I saw the string painted in black on a blue background.