fork download
  1. import java.awt.Color;
  2. import javax.swing.JApplet;
  3. import java.awt.Graphics;
  4.  
  5.  
  6. public class applet extends JApplet{
  7.  
  8. @Override
  9. public void paint(Graphics g){
  10.  
  11.  
  12. //making a rectangle with 400 width and 400 length
  13. //set its color to red
  14. String greeting = "Hello world!,my name is Folau Kaveinga and i am taking CIS 202.";
  15. String prog_A = "This is my first project as a java programmer...YEAH!!!";
  16. String poem = "i have chosen my favorite shortest poem to display.";
  17. g.setColor(Color.RED);
  18. g.fillRect(0, 0, 500, 500);
  19.  
  20. g.setColor(Color.BLACK);
  21. g.drawString(greeting, 50, 20);
  22. g.drawString(prog_A, 50, 40);
  23. g.drawString(poem, 50, 60);
  24.  
  25.  
  26. // putting up the applet rectangle and constructing it for my poem
  27. // set the text inside the parameters to black
  28. g.drawString("The Red Wheelbarrow", 200,100 );
  29. g.drawString("so much depends", 50, 120);
  30. g.drawString("on", 50, 130);
  31. g.drawString("a red wheel", 50, 150);
  32. g.drawString("barrow", 50, 160);
  33. g.drawString("glazed with rain", 50, 180);
  34. g.drawString("water", 50, 190);
  35. g.drawString("beside the white", 50, 210);
  36. g.drawString("chickens", 50, 220);
  37. g.drawString("by William Carlos Williams", 50, 250);
  38. }
  39.  
  40.  
  41. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:6: error: class applet is public, should be declared in a file named applet.java
public class applet extends JApplet{
       ^
1 error
stdout
Standard output is empty