Trouble with PointAttributes class

Hi,

I am using a fairly simple code to use the PointAttributes class. However, the porgram refuses to compile and points to these lines as erroneous....would very much appreciate some input here.

PointAttributes pt=new PointAttributes(size,false);

and

app.setPointAttributes(pt);

Code posed below:

import com.sun.j3d.utils.universe.*;

import com.sun.j3d.utils.geometry.*;

import javax.media.j3d.*;

import javax.media.j3d.PointAttributes.*;

import javax.vecmath.*;

import java.awt.*;

import java.awt.event.*;

publicclass PtAttributesextends Frameimplements ActionListener

{

protected Button myButton=new Button("Exit");

private SimpleUniverse u=null;

publicclass aPointextends Shape3D{

public aPoint(float xo,float yo,float zo,float size )

{

this.setGeometry(createPoint(xo, yo, zo));

this.setAppearance(createPointApp(size));

}

private Geometry createPoint(float x,float y,float z)

{

// x, y, z are (x, y, z) coordinate of the point

PointArray pt =new PointArray(1,GeometryArray.COORDINATES);

pt.setCoordinate(0,new Point3f(x, y, z));

return pt;

}

private Appearance createPointApp(float size)

{

Appearance app =new Appearance();//PointAttributes

// and Point antialiasing = false

PointAttributes pt=new PointAttributes(size,false);

//pointAtt.setPointSize(size);

//pointAtt.setPointAntialiasingEnable(false);

app.setPointAttributes(pt);

return app;

}

}//end class aPoint

public BranchGroup contentBranch()

{

BranchGroup objRoot =new BranchGroup();

// add more point here with different coordinates and point width

objRoot.addChild(new aPoint(0.3f, 0.4f, 0.0f, 4f));

objRoot.addChild(new aPoint(0.4f, -0.3f, 0.0f, 8f));

objRoot.addChild(new aPoint(-0.2f, 0.6f, 0.0f, 20f));

objRoot.compile();

return objRoot;

}

publicvoid actionPerformed(ActionEvent e)

{

dispose();

System.exit(0);

}//end actio performed

public PtAttributes()

{

GraphicsConfiguration config=SimpleUniverse.getPreferredConfiguration();

Canvas3D myCanvas=new Canvas3D(config);

BranchGroup scene=contentBranch();

u=new SimpleUniverse(myCanvas);

u.getViewingPlatform().setNominalViewingTransform();

u.addBranchGraph(scene);

setTitle("Appearance");

setSize(600,600);

setLayout(new BorderLayout());

add("Center",myCanvas);

add("South",myButton);

myButton.addActionListener(this);

setVisible(true);

}

publicstaticvoid main(String[] args)

{

PtAttributes point=new PtAttributes();

}

}//end class PtAttributes

[5516 byte] By [thulasy_sa] at [2007-11-26 13:30:22]
# 1
I removed this declaration (no such package PointAttributes.*)import javax.media.j3d.PointAttributes.*;and your code compiles fine.regards
messengersa at 2007-7-7 20:36:02 > top of Java-index,Security,Cryptography...