0

I'm new with java and only starting to "play" with it. I'm trying to start with graphics so I wrote this code:

import java.awt.*;
import acm.graphics.*;
import acm.program.*;

public class Gui extends GraphicsProgram
{

    public  void init (String[] args)
    {
        GRect rect = new GRect(100,100,50,50);
        rect.setFilled(true);
        rect.setFillColor(Color.RED);
        add(rect);

        GOval cir = new GOval(60,60);
        cir.setFilled(true);
        cir.setFillColor(Color.GREEN);
        add(cir);

        GLabel lab = new GLabel("hello");
        add(lab);
    }
}

but the applet is empty.

what can be wrong?

thx.

Radiodef
  • 37,180
  • 14
  • 90
  • 125
Ariel
  • 165
  • 1
  • 3
  • 15
  • 2
    If you are new to Java, try and avoid using obsolete technologies :p What you should use is JNLP instead of applets. – fge Apr 22 '15 at 07:37
  • Add `@Override` notation before the `public void init (String[] args)` for a revealing compiler error message. But in the bigger view, follow the advice of @fge - applets have been dying for a long time. Chrome browser is about to drop support for them completely and the best advice Oracle offers is 'use a different browser'. – Andrew Thompson Apr 23 '15 at 04:35
  • See also this related [Q&A](http://stackoverflow.com/q/17872245/230513). – trashgod May 13 '15 at 17:26

0 Answers0