Hii..i use the coding as below :-
import java.applet.applet;
import java.awt.*;
import com.sun.j3d.utils.applet.mainframe;
import com.sun.j3d.utils.universe.*;
import com.sun.j3d.utils.geometry.*;
import javax.media.j3d.*;
import javax.vecmath.*;
public class J3DLinesPoints extends Applet {
private SimpleUniverse u=null;
public BranchGroup createScene() {
BranchGroup objRoot = new BranchGroup();
TransformGroup tg = new TransformGroup();
Shape3D shapeLine = new Shape3D();
Transform3D t3d2 = new Transform3D();
PointArray pa = new PointArray(2,PointArray.COORDINATES | pOINTaRRAY.color_3);
LineArray la= new LineArray(2,LineArray.COORDINATES |LineArray.cOLOR_3);
Point3d[] ptsPoints = new Point3d[2];
Point3d[] ptsLine = new Point3d[2];
PointAttributes ptAtt = new PointAttributes();
Color3f[] colors = new Color3f[2];
Appearance appPoint = new Appearance();
t3d2.setscale(0.2);
tg.setTransform(t3d2);
objRoot.addChild(tg);
ptsPoints[0] = new Point3d(2,3,-2);
ptsPoints[1] = new Point3d(2,4,-2);
ptsLine[0] = new Point3d(1,1,-2);
ptsLine[1] = new Point3d(-2,2,-2);
colors[0] = new Color3f(1.0f,0.0f, 0.0f); //red
colors[1] = new color3f(0.0f,0.0f, 1.0f); //blue
pa.setCoordinates(0,ptsPoints); //set the coordinates of the points into the Point Array
pa.setColors(0,colors);
ptAtt.setPointSize(5.0f); //increase size of points to make them more visible
appPoint.setPOintAttributes(ptAtt);
shapePOint.setGeometry(pa);
shapePoint.setAppearance(appPoint);
la.setCoordinates(0,ptsLine); //set the coordinates of the line points into the LineArray
la.setColors(0,colors);
shapeLine.setGeometry(la);
tg.addChild(shapePoint);
tg.addChild(shapeLine);
objRoot.compile();
return objRoot;
}
public void init() {
setLayout(new BorderLayout());
GraphicsConfiguration config = SimpleUniverse.getPreferredConfiguration();
Canvas3D canvas = new Canvas3D(config);
canvas.setBackground(Color.yellow);
add("Center", canvas);
BranchGroup Scene= createScene();
u = new SimpleUniverse (canvas);
u.getViewingPlatform().setNominalViewingTransform( );
u.addBranchGraph(scene);
}
public static void main(String[] args) {
new MainFrame(new J3DLinesPoints(),500,400);
}
}
and the errors which i get in COMMAND prompt are as follows :-
U:\cadcam\java>javac J3DLinesPoints.java
J3DLinesPoints.java:1: cannot resolve symbol
symbol : class applet
location: package applet
import java.applet.applet;
^
J3DLinesPoints.java:3: cannot resolve symbol
symbol : class mainframe
location: package applet
import com.sun.j3d.utils.applet.mainframe;
^
J3DLinesPoints.java:9: cannot resolve symbol
symbol : class Applet
location: class J3DLinesPoints
public class J3DLinesPoints extends Applet {
^
J3DLinesPoints.java:18: cannot resolve symbol
symbol : variable pOINTaRRAY
location: class J3DLinesPoints
PointArray pa = new PointArray(2,PointArray.COORDINATES
| pOINTaRRAY.color_3);
^
J3DLinesPoints.java:19: cannot resolve symbol
symbol : variable cOLOR_3
location: class javax.media.j3d.LineArray
LineArray la= new LineArray(2,LineArray.COORDINATES |Lin
eArray.cOLOR_3);
^
J3DLinesPoints.java:25: cannot resolve symbol
symbol : method setscale (double)
location: class javax.media.j3d.Transform3D
t3d2.setscale(0.2);
^
J3DLinesPoints.java:35: cannot resolve symbol
symbol : class color3f
location: class J3DLinesPoints
colors[1] = new color3f(0.0f,0.0f, 1.0f); //blue
^
J3DLinesPoints.java:40: cannot resolve symbol
symbol : method setPOintAttributes (javax.media.j3d.PointAttributes)
location: class javax.media.j3d.Appearance
appPoint.setPOintAttributes(ptAtt);
^
J3DLinesPoints.java:41: cannot resolve symbol
symbol : variable shapePOint
location: class J3DLinesPoints
shapePOint.setGeometry(pa);
^
J3DLinesPoints.java:42: cannot resolve symbol
symbol : variable shapePoint
location: class J3DLinesPoints
shapePoint.setAppearance(appPoint);
^
J3DLinesPoints.java:48: cannot resolve symbol
symbol : variable shapePoint
location: class J3DLinesPoints
tg.addChild(shapePoint);
^
J3DLinesPoints.java:55: cannot resolve symbol
symbol : method setLayout (java.awt.BorderLayout)
location: class J3DLinesPoints
setLayout(new BorderLayout());
^
J3DLinesPoints.java:59: cannot resolve symbol
symbol : method add (java.lang.String,javax.media.j3d.Canvas3D)
location: class J3DLinesPoints
add("Center", canvas);
^
J3DLinesPoints.java:63: cannot resolve symbol
symbol : variable scene
location: class J3DLinesPoints
u.addBranchGraph(scene);
^
J3DLinesPoints.java:67: cannot resolve symbol
symbol : class MainFrame
location: class J3DLinesPoints
new MainFrame(new J3DLinesPoints(),500,400);
^
15 errors
I am very new..to this java programming so please if you can give me some detailed explannations for the answers.
I refer few blogs on the site for the same error which suggests to give CLASS PATH along with the "javac" command....i tried that too..
but i was not able to do that...
thank you
vishal patel