Hello, I decided to make an applet in java and wanted to use drJava for it. I installed the program and the JDK. Then, after making a code to start from, I ran into a problem.
This is the code:
import java.swing.JApplet; import java.awt.*; public class FirstAppletDrawing extends Applet{ public void paint (Graphics page){ setBackground (Color.cyan); //background color page.setColor (Color.gray); //Robot head color page.drawRec (3,4,20,20); //Robot head } }
When I try to compile it, the first error I get is: Error: The import java.swing cannot be resolved
I thought that I may be doing something wrong, so I decided to try and make a simpler program:
public class Simple{ public static void main (Strings[] args){ int future = 5; int past = 1; int present = future - past; System.out.println("Our future is " + future + ", our past is " + past + ", and our present is" + present); } }
When I tried to compile that, I go this: Error: Strings cannot be resolved to a type
And that's basically from the book. Am I missing something or doing something wrong?