Basic question about creating graphical object in java
My school is making me take a course in java. I dont have any previous experiance with it so;
Im elaborating a little with creating classes with graphic content. I came upp with the following code;
-----------------------------
import java.awt.*;
import java.applet.*;
import javax.swing.*;
public class som15 extends JApplet {
public void init() {
vision stuff1=new vision();
stuff1.paint();
}
}
class vision extends Canvas {
int a=40;
int b=40;
int c=80;
int d=80;
public void paint (Graphics g) {
g.drawLine(a, b, c, d);
}
}
---------------------------
Now this doesnt compile. What did I miss?
peace /Carlis
My school is making me take a course in java. I dont have any previous experiance with it so;
Im elaborating a little with creating classes with graphic content. I came upp with the following code;
-----------------------------
import java.awt.*;
import java.applet.*;
import javax.swing.*;
public class som15 extends JApplet {
public void init() {
vision stuff1=new vision();
stuff1.paint();
}
}
class vision extends Canvas {
int a=40;
int b=40;
int c=80;
int d=80;
public void paint (Graphics g) {
g.drawLine(a, b, c, d);
}
}
---------------------------
Now this doesnt compile. What did I miss?
peace /Carlis