The field Component.graphicsConfig is not visible

View: New views
4 Messages — Rating Filter:   Alert me  

The field Component.graphicsConfig is not visible

by java3d-interest :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi all,
         I am willing to use Java 3D API for my project to develop a user interface with graphs.

I am trying to run the sample program given on the following page:

http://java.sun.com/javase/technologies/desktop/java3d/forDevelopers/j3dguide/Intro.doc.html#47513

But it gives me the error: "The field Component.graphicsConfig is not visible" on the following line: Canvas3D c = new Canvas3D(graphicsConfig);  in "HelloUniverse.java"

Does anyone know a solution to this error.

Thanks in advance,
KG
[Message sent by forum member 'kalpeshgada' (kalpeshgada)]

http://forums.java.net/jive/thread.jspa?messageID=284597

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@...
For additional commands, e-mail: interest-help@...


Re: The field Component.graphicsConfig is not visible

by java3d-interest :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Try replacing it with
[code]
Canvas3D c = new Canvas3D(getGraphicsConfiguration());
[/code]
[Message sent by forum member 'morne' (morne)]

http://forums.java.net/jive/thread.jspa?messageID=284600

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@...
For additional commands, e-mail: interest-help@...


Re: The field Component.graphicsConfig is not visible

by java3d-interest :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks a lot for the reply.

I could get rid of the compile time error but however the runtime error still persists. Following is the error trace:

java.lang.NullPointerException: Canvas3D: null GraphicsConfiguration
        at javax.media.j3d.Canvas3D.checkForValidGraphicsConfig(Canvas3D.java:982)
        at javax.media.j3d.Canvas3D.<init>(Canvas3D.java:1025)
        at j3d.HelloUniverse.<init>(HelloUniverse.java:52)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
        at java.lang.reflect.Constructor.newInstance(Unknown Source)
        at java.lang.Class.newInstance0(Unknown Source)
        at java.lang.Class.newInstance(Unknown Source)
        at sun.applet.AppletPanel.createApplet(Unknown Source)
        at sun.applet.AppletPanel.runLoader(Unknown Source)
        at sun.applet.AppletPanel.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)

All my attempt was to make it running and understand how it works. However I could some sample files from
http://www.hig.se/~mbm/kurser/0405/j3d/tutorial/examples/HelloJava3D/
so as to get an idea of how it works.
Thanks again.

-KG
[Message sent by forum member 'kalpeshgada' (kalpeshgada)]

http://forums.java.net/jive/thread.jspa?messageID=284611

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@...
For additional commands, e-mail: interest-help@...


Re: The field Component.graphicsConfig is not visible

by java3d-interest :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> Thanks a lot for the reply.
>
> I could get rid of the compile time error but however
> the runtime error still persists. Following is the
> error trace:
>
> java.lang.NullPointerException: Canvas3D: null
> GraphicsConfiguration

Yeah, that's because the Canvas3D hasn't been attached to a Container yet.

What I did when I needed a GraphicsConfiguration before attaching my Canvas3D - and I'm sure this isn't the right way - is to grab the default graphics configuration, like so :

[code]
GraphicsEnvironment myEnvironment = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice myDevice = myEnvironment.getDefaultScreenDevice();
GraphicsConfiguration myGraphicsConfig = myDevice.getDefaultConfiguration();
[/code]

It works for me...

\m/
[Message sent by forum member 'morne' (morne)]

http://forums.java.net/jive/thread.jspa?messageID=284618

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@...
For additional commands, e-mail: interest-help@...

LightInTheBox - Buy quality products at wholesale price