Computer Science Canada

Problem Importing Pictures

Author:  ste_louis26 [ Tue Dec 27, 2005 5:02 pm ]
Post subject:  Problem Importing Pictures

(ready to program)
I'm having a problem at the the 14-17th lines in the following code
i'm getting the following errors:

No Method named 'getToolkit' was found in type "hsa.Console".
No Method named 'prepareImage' was found in type "hsa.Console".
No applicable overload was found for a constructor of type "java.awt......etc


Quote:

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

public class SimpleGif
{
static Console c;
static Image picture;
static int picWidth, picHeight;
private static final String fileName = "mypic.gif";

public static void loadImage ()
{
picture = c.getToolkit ().getImage (fileName);
c.prepareImage (picture, c);

MediaTracker tracker = new MediaTracker (c);
tracker.addImage (picture, 0);
try
{
tracker.waitForAll ();
}
catch (InterruptedException e)
{
}

if (tracker.isErrorAny ())
{
c.println ("Coundn't load " + fileName);
return;
}

picWidth = picture.getWidth (null);
picHeight = picture.getHeight (null);
}


public static void displayImage ()
{
loadImage ();
c.drawImage (picture, 0, 0, null);
c.drawImage (picture, 100, 0, null);
c.drawImage (picture, 200, 300, null);
c.drawImage (picture, 300, 200, null);
c.drawImage (picture, 300 + picWidth, 200 + picHeight, null);
}


public SimpleGif ()
{
c = new Console ();
}


public static void main (String[] args)
{
SimpleGif g = new SimpleGif ();
g.displayImage ();
}
}


any help?


: