Hey there!
I was wondering if someone here could help me out a bit. I'm a beginner in Java and I'm struggling a bit with understanding if it is me who is doing something wrong or if something is just missing from my software to run the thing I'm trying to do.
What I have here is some basic applet from my textbook. What it is supposed to do, is make a small clutter of symbols and write a qoute, but when I try to compile and run it, I get the following errors:
'class' or 'interface' expected
javax.swing.JApplet;
^
'class' or 'interface' expected
java.awt.*;
^
'class' or 'interface' expected
Einstein JApplet
^
3 errors
This is the applet here:
//Einstein.java
//Demonstrates a basic applet.
javax.swing.JApplet;
java.awt.*;
Einstein JApplet
{
//Draws some forms and writes a qoute.
paint (Graphics page)
{
page.drawRect (50, 50, 40, 40); //square
page.drawRect (60, 80, 225, 30); //rectangle
page.drawOval (75, 65, 20, 20); //circle
page.drawLine (35, 60, 100, 120); //line
page.drawString ("Out of clutter, find simplicity.", 110, 70);
page.drawString ("-- Albert Einstein", 130, 100);
}
}
The software I'm using is TextMate 1.5.7
The example in the book shows Windows screen, but I haven't been told otherwise than it is fine for me to use a mac, but still I can't get this to run and I'm pretty sure I've copied the code exactly from the book.
Could someone please advice me or tell me if/what I'm doing wrong here? Or if I am missing some additional software that I need?
(My apologies for poor grammar, English ain't my first language.)
Thanks in advance!