I have the following code and it isn't working:
import net.java.games.jogl.*;
import java.awt.Color;
import java.awt.Frame;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
public class Game {
public static void main(String[] args) {
// TODO Auto-generated method stub
Frame frame = new Frame("Hello World");
GLCanvas canvas = GLDrawableFactory.getFactory().createGLCanvas(new GLCapabilities());
frame.add(canvas);
frame.setSize(300, 300);
frame.setBackground(Color.WHITE);
frame.addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
});
frame.show();
}
}
The first import has an error where it does not recognise what "net" is. The error is below:
The import net cannot be resolved
The full error when I try to run the program is:
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
GLCapabilities cannot be resolved to a type
The method add(Component) in the type Container is not applicable for the arguments (GLCanvas)at Game.main(Game.java:15)